0

Can someone explain the second line of this code of python ??

num = int(input("Enter the number)) for i in range(10, 0, - 1): print(f"{num}*{i}={num*i}")

29th Apr 2022, 3:41 PM
Avinash Tiwari 👨🏻‍💻
Avinash Tiwari 👨🏻‍💻 - avatar
4 ответов
+ 4
Avinash Tiwari range(10, 0, - 1) This will give list in reverse order means 9 8 7 {num} * {i} this will give string format of multiplication of num * i so it will be like 5 * 10 5 * 9 {num * i} this will give multiplied value like 50 45 40 .. last line is like: print (str(num) + "*" + str(i) + "=" + str(num * i))
29th Apr 2022, 3:53 PM
A͢J
A͢J - avatar
+ 3
Avinash Tiwari Are you learning python from outside because I don't see any python code. You have written in C, C++, php, web but not in python.
30th Apr 2022, 2:22 AM
A͢J
A͢J - avatar
+ 2
BTW, indentation of line 3 is wrong. This will give a syntax error.
29th Apr 2022, 11:43 PM
Emerson Prado
Emerson Prado - avatar
+ 1
A͢J Yes I'm learning python from YouTube lectures... Just started here to clear my doubt. And thanku so much for above explanation.
30th Apr 2022, 3:36 AM
Avinash Tiwari 👨🏻‍💻
Avinash Tiwari 👨🏻‍💻 - avatar