The quiz where the difficulty automagically adapts to the player's Python knowledge
This is a question page. You can use this page to bookmark a question. Start a new quiz!
Question #880
my_var = "Python"
id1 = id(my_var)
my_var += " rocks!"
id2 = id(my_var)
print(id1 == id2)
Whenever the += operator is used against a string, a new string is returned. (python-reference.readthedocs.io/en/latest/docs/operators/...)
What is the output of the code snippet below?
— The Python Quiz (@thepythonquiz) June 22, 2021
my_var = "Python"
id1 = id(my_var)
my_var += " rocks!"
id2 = id(my_var)
print(id1 == id2)
True
False
π Comment the answer, like and retweet! #python
Question difficulty: π΅π΅π΅π΅π΅
Similar questions: