Post

Python Programming
Python Programming@PythonPr·
Python Quz: Can you answer the below question?
Python Programming tweet media
English
7
4
41
4.6K
Theoden
Theoden@J_Theoden·
@PythonPr 28.2 The 2_4 in the x variable is interpreted by Python as 24, so the sum becomes 1 + 24 + 3.2 = 28.2
English
0
0
2
125
Sergei Kotov
Sergei Kotov@kotov_dev·
@PythonPr Answer: 28.2 Two traps in one! › 2_4 is not a typo. An underscore = readability separator › 2_4 is 24 (same as 1_000_000 is 1000000) › x is a tuple (commas): (1, 24, 3.2) › sum(1, 24, 3.2) = 28.2 For beginners: _ in numbers is just visual spacing for readability.
English
0
0
1
104
Jimmy Fikes
Jimmy Fikes@akajim·
@PythonPr Python ignores underscores between numbers, so the sum is 28.2
English
0
0
1
104
Michael Anaya
Michael Anaya@miguel95658·
@PythonPr x = 1, 2_ 4, 3.2 ^ SyntaxError: invalid decimal literal >>>
Dansk
0
0
0
126
Oscar Mayer
Oscar Mayer@oscarmayer·
The Wienie 500 is back. Tune in at 2pm ET on FOX to see who will taste victory, cook the competition, and earn the title of top dog.
Oscar Mayer tweet media
English
155
467
4.4K
10.5M
Paylaş