1. Valid vs Invalid Variable Name
_myVar = 10
Is this a valid variable name? Why?
2. Variable Naming Restriction
for = 25
Why can’t this assignment be used?
3. Implicit Type
value = "123"
What data type is stored in value and why?
4. Float Conversion
float("8")
What does this expression return and why?
5. Failed Conversion
int("abc")
Why does this generate a ValueError?
6. Mixed Arithmetic
result = 5 + 2.0
What is the type of result, and why?
7. Zero Division Error
print(10 / 0)
Why does this error occur?
8. Operator Precedence
print(2 + 3 * 4)
Why is the result not 20?
9. Comparison Output
print(5 < 3)
What value does this print, and why?
10. Equality Check
print("5" == 5)
Why does this comparison return False?
11. If Condition Behavior
if 0:
print("Yes")
Why does this not print anything?
12. Elif Skipping
x = 15
if x > 20:
print("A")
elif x > 10:
print("B")
Why does it print only "B"?
13. Unreachable Else
if True:
print("Hello")
else:
print("Goodbye")
Why will the else block never run?
14. Indentation Inside Block
if x == 5:
y = 10
print(y)
Why does this code show an indentation error?
15. Print Separator Effect
print(1, 2, 3, sep="")
Why does this print 123 without spaces?
16. Changing Print End
print("Start", end="...")
print("End")
How does the end parameter affect the output?
17. String Multiplication
print("Hi" * 3)
Why does this produce HiHiHi?
18. Concatenation Requirement
message = "Age: " + str(30)
Why is str(30) needed here?
19. Triple-Quoted String Not Assigned
"""
Hello
World
"""
print("Done")
Why is the triple-quoted block ignored?
20. Escape Sequence
print("Hello\tWorld")
What does \t do in this output?
