@PythonPr
Python Programming
1 month
Python Question / Quiz; What is the output of the following Python code, and why? Comment your answers below!
74
28
373

Replies

@codewithimanshu
Himanshu Kumar
1 month
@PythonPr Right, Python, that's a good one, let's see who gets the answer and the logic behind it, yeah?
0
0
2
@iam_Amadeus
Amadeus
1 month
@PythonPr 2 3 Not 23
0
0
30
@Earnesto037
Earnest Codes
1 month
@PythonPr Answer: 23 The code initializes the variable number to 10. The first if statement checks if number is equal to 5. Since this is false, the code executes the else block. Inside the else block, print("2") is executed, which prints "2". After that, a new,
1
0
17
@Adnan1_UK
AdnAn1_UK
1 month
@PythonPr 2 3
0
0
6
@Matt_MSZ
Matt
1 month
@PythonPr 23 Number is 10 First statement says if it is 5 do this. Since the number is 10, this statement is false and it moves onto the else statement. the statement says other than first statement print a 2 under the else looks at number again says if it’s a 10 print 3 Being it does
0
0
3
@JoseBatista4321
José Batista
1 month
@PythonPr thats ridiculous even for a python scripter
0
0
3
@fr0viros4
Francesc Rovirosa
1 month
@PythonPr 2 3
0
0
3
@Kyiv85
Daniel E Delgado D 🇻🇪❤️🇦🇷
1 month
@PythonPr 2 3 Separated in different lines.
0
0
3
@leshanMuyantet
isaack leshan
1 month
@PythonPr The output 2 followed by 3 is true
0
0
2
@kotov_dev
Sergei Kotov | Python Made Simple
1 month
@PythonPr Answer: 2 3 The key insight: the if inside else is just regular code, NOT elif! › First if (5) fails → else runs › Prints "2" › Then the nested if (10) checks and prints "3" For beginners: Code inside else executes line-by-line like normal!
0
0
1
@LoreCeccoli
Lorena Ceccoli
1 month
@PythonPr 2 3
0
0
1
@_n0shdwDrgn666_
•|R∞ts⚡ 🎙️|• SøØthSlayer|•
1 month
@PythonPr 2 3
0
0
1
@wa__cys
وهيب الحميري ᴡᴀʜᴇᴇʙ ᴀʟ-ʜɪᴍʏᴀʀɪ | أمن سيبراني
1 month
@PythonPr 2 3
0
0
1
@emmazyxp
Xperience EMMAZY
1 month
@PythonPr It's actually ''3''(3 as a string) ✨✍🏼
0
0
1
@suRetiredHurt
Suhas
1 month
0
0
1
@Obito_namikaze1
Bharath
1 month
@PythonPr Is 2,3 correct of this @grok
1
0
1
@FelipePerlaza
Felipe@Perlaza🚀
1 month
@PythonPr 2 3
0
0
1
@MarcoRomildo
Marco Cappellari
1 month
0
0
1
@cristhian2900
Cristhian Zambrano
1 month
@PythonPr 2 3
0
0
1
@iam_Sydney06
Thenew_Krisdon
1 month
@PythonPr It's 2. I have a strong feeling that it's 2
0
0
1
@Gideon_EA
Gideonovich Enochovich
1 month
@PythonPr @grok what is the right answer? 23 or 2 3 or 2,3?
1
0
1
@mromeros_1602
MarcosRomeroSalazar
1 month
@PythonPr 2 3
0
0
1
@11_Fabio_11
Kirabi_11_Z
1 month
@PythonPr 23 ,right?
0
0
1
@ShahedRahman_1
Shahed Rahman
1 month
@PythonPr 2 3
0
0
1
@HeritierRobin
Héritier KACHELE
1 month
@PythonPr The answer is 23.
0
0
1
@CristhianSaudin
Cristhian Saudin
1 month
@PythonPr 2 3
0
0
1
@sarvesh_dwivedi
Sarvesh Dwivedi
1 month
0
0
1
@arunreddy1820
Arun Reddy
1 month
0
0
1
@felixoyie
Felix.dev
1 month
@PythonPr 2 3, order of sequence!
0
0
1
@Sanjeev00739677
Sanjeev Kaushik
1 month
0
0
1
@RightWrongBW
RWBW
1 month
@PythonPr 2 3
0
0
1
@ITSMESRIDHAR91
Sai Sri
1 month
@PythonPr 2 3
0
0
1
@ToulouseCompos1
TOULOUSE COMPOSANTS ELECTRONIQUES
1 month
@PythonPr Gag
0
0
1
@kuanghuanlonga1
Steven · 爱乌
1 month
@PythonPr 来个更有挑战性的题吧
0
0
1
@kuanghuanlonga1
Steven · 爱乌
1 month
0
0
1
@obed_blac
Chiefof_Defense
1 month
0
0
1