0
In the program why we typecast in srt then assign in result? what is the means of str?
num1 = float(input("Enter a number: ")) num2 = float(input("Enter another number: ")) result = str(num1 + num2) print("The answer is " + result)
2 ответов
+ 2
str() converts its argument to a string. Since you have a numerical value of float type, of you want to concatenate it to a text, you have to convert it to a string.