Test Index

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

© examsnet.com
Question : 98 of 102
Marks: +1, -0
What will the following expression be evaluated to in Python ?
print(6/3 + 4**3//8-4)
[CBSE 2023 Compartment]
Solution:  
Concept:
Precedence: ** first, then /, // (left to right), then +, -. The operator / always gives a float.
Explanation:
Step 1: 4**3 = 64
Step 2: 6/3 = 2.0 and 64//8 = 8
Step 3: 2.0 + 8 - 4 = 6.0
Output:
6.0
The result is a float because of /, so it is 6.0 and not 6.
Answer:
Option C (6.0)
© examsnet.com
Advertisements
Go to Question: