KnowledgeBoat Logo
|

Informatics Practices

Give the output of the following when num1 = 4, num2 = 3, num3 = 2.

num1 = int('3.14')
print(num1)

Python Control Flow

1 Like

Answer

The code will raise a Error because we cannot convert the string '3.14' to an integer directly using int() function in Python due to the presence of a decimal point. Python expects the string to represent a whole number when converting to an integer.

Answered By

2 Likes


Related Questions