Test Index

Python Revision Tour Get it on Google PlayDownload on the App Store CBSE Board Videos

© examsnet.com
Question : 85 of 102
Marks: +1, -0
What will the following expression be evaluated to in Python ?
print(4+3*5/3-5%2)
[CBSE 2023 Set 4]
Solution:  
Concept:
Precedence: *, /, % (left to right) before +, -. The operator / always gives a float.
Explanation:
Step 1: 3*5 = 15
Step 2: 15/3 = 5.0
Step 3: 5%2 = 1
Step 4: 4 + 5.0 - 1 = 8.0
The result is a float because of the /, so it is 8.0 and not 8.
Answer:
Option B (8.0)
© examsnet.com
Advertisements
Go to Question: