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 #882
def my_function(an_int: int):
return an_int * 2
print(my_function("Python"))
Even though the function parameter type is annotated (the function is expecting to receive an int ), it doesn't mean that the argument has to be of this type. (python.org/dev/peps/pep-0484)
What is the output of the code snippet below?
— The Python Quiz (@thepythonquiz) June 23, 2021
def my_function(an_int: int):
return an_int * 2
print(my_function("Python"))
2
It will throw a SyntaxError exception.
PythonPython
π Comment the answer, like and retweet! #python
Question difficulty: π΅π΅π΅π΅π΅
Similar questions: