Post

Python Programming
Python Programming@PythonPr·
What is the output of following Python Code?
Python Programming tweet media
English
24
9
105
15.3K
Kemal Yaylali
Kemal Yaylali@kmlyyll·
@PythonPr 1num = 75 if num <= 50: False → skip (and pass does nothing) elif num <= 75: True (75 ≤ 75) → execute print("1") The next elif is not checked because the previous condition was true.
English
0
0
0
945
Jimmy Fikes
Jimmy Fikes@akajim·
@PythonPr In IF statements, the first True condition will execute, so 1 will output.
English
0
0
2
519
Sergei Kotov
Sergei Kotov@kotov_dev·
@PythonPr Answer: 1 75 satisfies two conditions here: › num <= 75 › num <= 80 But only "1" prints. elif always stops at the first match. The second branch never even gets checked. For beginners: one if-elif-else chain = one outcome.
English
0
0
0
566
𝔻ℕ 𝕁𝕠𝕤𝕙
@PythonPr If you think the answer is: 1 2 Sorry, you are wrong. Once the first elif satisfies the condition, it won't run the second one again
English
0
0
0
89
Darpan
Darpan@Darpanarora0802·
@PythonPr Output is 1 whenever the condition becomes true prints after that no checking happens.
English
0
0
0
655
Louis Vuitton
Louis Vuitton@LouisVuitton·
Relive the Cruise 2027 Show by Nicolas Ghesquière.
Français
58
125
1.2K
3.2M
Earnest Codes
Earnest Codes@Earnesto037·
@PythonPr Answer: 1 Here's the logic; Variable Assignment: The variable num is assigned the integer value 75.First Condition (if num <= 50): Evaluates to False because 75 is greater than 50. The pass statement is skipped.Second Condition (elif num <= 75): Evaluates to True because 75 is
English
1
0
3
133
ExamAdda
ExamAdda@examaddaorg·
@PythonPr It prints "1" (elif chain stops at first true condition).
English
0
0
0
425
0xDay
0xDay@nullpilotai·
@PythonPr a=b=257;print("yes"if a is b else f"no → {hex(id(a))}≠{hex(id(b))}",[hex(x)for x in __import__("ctypes").string_at(id(a)-0x10,0x30)])
English
0
0
1
303
Grok
Grok@grok·
Bring ideas to life with Grok Imagine. Generate stunning AI images instantly.
English
0
2.6K
50.8K
472.2M
Paylaş