Robotics & Artificial Intelligence
Predict the output of the following snippet:
a=42.85
b=int(a)
print(b)
Python Functions
1 Like
Answer
Output
42
Explanation
The int() function takes a floating-point value and truncates the decimal part to return an integer. Hence, 42.85 becomes 42 and is stored in b, which is then displayed.
Answered By
2 Likes
Related Questions
State whether the following statements are True or False:
- A function cannot be defined without parameters.
- The return statement without parameter indicates a non-returnable function.
- A function can return only one value to its caller program.
- The parameters used in the function definition are called actual parameters.
- A function may or may not return a value to the main program.
- A function always contains the header and the footer.
Predict the output of the following snippet:
m=32 n=float(m) print(n)Predict the output of the following snippet:
wd="Robotics" print(len(wd))Predict the output of the following snippet:
List1=["Happy", "New", "Year", 2026] print(len(List1))