+ 1
Im stumped on how this code works (in description)
>>> float(input("Enter a number: ")) + float(input("Enter another number: ")) Enter a number: 40 Enter another number: 2 42.0 I don't understand this at all, and need a thorough explanation. thanks!
1 ответ
+ 1
first get input of the first number. then convert it to a float. so float (input) for the first number gives 40.0
do this for the second number also and it gives 2.0
but the statement is adding both numbers using the "+", so it becomes 40.0 + 2.0 = 42.0