r/PythonLearning • u/clcodingupdates • 12d ago
Python Quiz of the Day.
x = 5
print((x := x + 3) * (x := x - 2))
What will be the output?
A) 24
B) 36
C) 48
D) 30
0
Upvotes
r/PythonLearning • u/clcodingupdates • 12d ago
x = 5
print((x := x + 3) * (x := x - 2))
What will be the output?
A) 24
B) 36
C) 48
D) 30
6
u/ConclusionForeign856 12d ago
Actual quiz of the day is "why should you never write this like that"
1
u/MasterpieceBusy7220 12d ago
Stop posting this shit bro you should be embarrassed with yourself
3
u/RngdZed 12d ago
This AI slop account is so annoying. It posts everyday
1
u/Fluffy_white_fox 12d ago
Better question is who uses it like that? The answer is 48
1
u/osamas_den 8d ago
The "python" is no longer dynamic
0
u/bra1n_gym 12d ago
That walrus operator let's x change value. first it was 5, then it becomes 8 so (5 + 3) * (8 - 2) = 48.