-5
\$\begingroup\$
for i in range(1,int(input())+1): 
    print(((10**i -1)//9)*((10**i -1)//9))
print('lol just need to fill one more line to post the question IGNORE IT')

What is the meaning of '*' in between ((10**i -1)//9) and ((10**i -1)//9) in the above print statement?

\$\endgroup\$
  • 1
    \$\begingroup\$ Welcome to Code Review. Code Review is a place to help improve your code after you have successfully implemented and tested it. Questions asking for explanation of code you do not understand are off-topic for this site and will be closed. See What topics can I ask about? for reference. \$\endgroup\$ – L. F. Apr 11 at 7:29
  • \$\begingroup\$ That's plain multiplication. \$\endgroup\$ – md2perpe Apr 11 at 10:59
0
\$\begingroup\$

Let's first look at what you are printing:

((10**i -1)//9)*((10**i -1)//9) 

#that is the math task, from which you are printing the result

You asked what * means. This is the multiplication operator...

Let's look at the other things, so you get a better understanding of what is going on

result = 10**i - 1

Here you are doing 10 to the power of i and then minus one. The ** operator means to the power of...

So 2**4 means 2^4 or two to the power of four.

Then you are dividing the result of that task with 9 (result)//9 You are using // which is the floor division. This will cut of the decimal place.

The right side after the * is just the same as the first one. You multiply them with the * operator.

result = (10**i -1)//9
print( result * result ) #Multiplication

I hope that this helped you.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Welcome to Code Review! As you may have noticed, the question is closed as being off-topic. If OP edits their post to address the problem and make their post on-topic, they make your answer moot. It is advised not to answer such questions. Protip: There are tons of on-topic questions to answer; you'll make more reputation faster if you review code in questions that will get higher view counts for being on-topic. \$\endgroup\$ – Sᴀᴍ Onᴇᴌᴀ Apr 16 at 17:38
2
\$\begingroup\$

** this means power , for example : 5 ** 2 which mean : 5 squared --> 25.
2 ** 7 which mean : 2 to the power of 7 -- > 128.

// this means Floor division - division that results into whole number adjusted to the left in the number line.
For example:

x = 15
y = 4
print('x / y =',x/y)   # Output: x / y = 3.75
print('x // y =',x//y) # Output: x // y = 3
print('x ** y =',x**y) # Output: x ** y = 50625
print('x * y =',x*y)   # Output: x * y = 60

Update
To be more clear : * this means multiplication operator.

Hope that helps you , Good Luck

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Welcome to Code Review! As you may have noticed, the question is closed as being off-topic. If OP edits their post to address the problem and make their post on-topic, they make your answer moot. It is advised not to answer such questions. Protip: There are tons of on-topic questions to answer; you'll make more reputation faster if you review code in questions that will get higher view counts for being on-topic. \$\endgroup\$ – Sᴀᴍ Onᴇᴌᴀ Apr 16 at 17:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.