+ 1
type conversion
>>> float("210" * int(input("Enter a number:" ))) Enter a number: 2 How does this works?
4 Answers
+ 2
the input will be converted to integer, string and integer multiplication just repeat the string:
"210"*2 ==> "210210"
the result of the multiplication will finally be converted to float. so the final output is
210210.0
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2427/
+ 1
The class str support the multiplication and division
"210"*2 = "210" + "210" = "210210"
And the content for this value is the number and the float result is 210210.0
0
1.input returns string
2.int casts value to integer
3."210" * integer value gives value times repeated "210"
because strings have different multiplication operator
4.float casts string value to real number (noninteger)
0
Thank you sir, my doubt has cleared