Computer Science
Give the output of the following:
num1 = int(float('3.14'))
print(num1)
Python
Python Control Flow
2 Likes
Answer
3
Working
The expression float('3.14') converts the string '3.14' to the floating-point number 3.14. The int() function then converts 3.14 to the integer 3 by truncating the decimal part. Thus, num1 is assigned the value 3, and print(num1) outputs 3.
Answered By
2 Likes
Related Questions
Give the output of the following when num1 = 4, num2 = 3, num3 = 2.
num1 = 2 + 9 * ((3*12)-8)/10 print(num1)Give the output of the following when num1 = 4, num2 = 3, num3 = 2.
num1 = float(10) print(num1)Give the output of the following:
print (10 != 9 and 20 >= 20)Give the output of the following:
print(5 % 10 + 10 < 50 and 29 <= 29)