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
49
10
120
22.6K
Jenny
Jenny@JennyTheDev·
@PythonPr A. True str(10) converts int to "10", and "10" == "10" Python: "I don't care what you meant, I care what you typed"
English
0
0
6
1.2K
Kamal Gurjar
Kamal Gurjar@KamalGurjar8·
@PythonPr Output: True, str() casts 10 to "10", so the equality check passes.
English
0
0
5
1.3K
🅾🅼🅰🅼🅾🆁🅸
🅾🅼🅰🅼🅾🆁🅸@oMaMoriTTV·
Hints are here, guys 🙂 Before answering, think about what "str" means in Python. "str" is short for string it’s a built in function that converts a value into text. It’s one of the simplest but most important functions in Python. You can pass almost anything into str() -> a number, a list, a boolean… and it returns the string version of that value. This is super useful when printing, comparing, or formatting values. Think about the comparison 🧐 a == b -> different types a == str(b) -> both strings With these hints… what do you think the answer is, guys 🙂
GIF
English
0
1
2
787
Ranjan
Ranjan@Ranjanrgdev·
@PythonPr True Because str() function converts int to string @grok am I correct
English
1
0
2
2.3K
Jay
Jay@learnaiwthme·
@PythonPr Answer: A — True Why: a is the string "10". b is the integer 10, and str(b) converts it to the string "10". So "10" == "10" evaluates to True.
English
0
0
1
18
하오리 🦆📒
하오리 🦆📒@haori_notes·
@PythonPr A. True a is a string "10" and str(b) converts the integer 10 into the string "10". So both sides become the same string, and the comparison returns True.
English
0
0
0
26
Einar Mjoksigland
Einar Mjoksigland@mjoksigland·
@PythonPr My answer is true, as at the end we are telling to transform that int into a str, so it makes it True
English
0
0
0
2
Paylaş