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
20
4
76
8.6K
Jimmy Fikes
Jimmy Fikes@akajim·
@PythonPr B. 4 ^ 0 is 1 and 4 ^ 1 is 4. I need 2 of the 4 ^ 1 which is 8 and none of the 4^0 so the sum of 8+0 is 8.
English
0
0
3
405
Polymath
Polymath@Apphollow·
@PythonPr base four integer "20" that would be two times four so that's 8
English
0
0
1
135
Karathanasis Athanasios
Karathanasis Athanasios@k_athanasi·
@PythonPr B) 8 int("20", 4) means interpret the string "20" as a base 4 number 2*4^1 + 0*4^0 = 8 int("20", 10) would be the same as the default int("20")that is the base we usaly use 2*10^1 + 0*10^0 = 20
English
0
0
3
309
Paylaş