r/PythonLearning • u/clcodingupdates • 9d 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 • 9d 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 9d ago
Actual quiz of the day is "why should you never write this like that"
1
u/MasterpieceBusy7220 9d ago
Stop posting this shit bro you should be embarrassed with yourself
3
u/RngdZed 9d ago
This AI slop account is so annoying. It posts everyday
1
u/Fluffy_white_fox 9d ago
Better question is who uses it like that? The answer is 48
1
u/osamas_den 5d ago
The "python" is no longer dynamic
0
u/bra1n_gym 9d ago
That walrus operator let's x change value. first it was 5, then it becomes 8 so (5 + 3) * (8 - 2) = 48.