Post

Python Programming
Python Programming@PythonPr·
Python Question / Quiz; What is the output of the following Python code, and why? Comment your answers below!
Python Programming tweet media
English
26
29
251
21.7K
Sergei Kotov
Sergei Kotov@kotov_dev·
@PythonPr The trick: boolean values act as integers (True=1, False=0) in arithmetic operations. True is 1 and False is 0. So the result is 1 (True) + 0 (false) + 1 ( true) = 2
English
0
0
0
866
Che Lou
Che Lou@CheLouPhysiMath·
@PythonPr B.2 (0%2==0)=1 (1%2==0)=0 (2%2==0)=1
0
0
0
497
Ravi Kumar
Ravi Kumar@RaviKumarJangir·
@PythonPr Inner bracket true for only 0 and 2 . So answer is 2
English
0
0
0
190
Abi
Abi@ArdaGulERA·
@PythonPr I’m new to Python so I might be wrong but I would like someone to explain it to me. I guessed it was B (2) but because x=0 and the only even number in range (3) is 2. So I did basic math 0=0+2, so x=2. Please explain why this is probably a wrong reasoning🙏
English
0
0
0
287
laso
laso@lasitolas·
@PythonPr B... abit of math understanding about modulus is useful. 2 satisfies the condition stated as it is 2+0=2
English
0
0
0
125
TechLatest.Net
TechLatest.Net@TechlatestNet·
@PythonPr Clear Python ideas are worth sharing, these concise guides help learners of all levels,
English
0
0
0
27
Paylaş