Questions about 🐍Python 3
English
Intermediate
30
Questions
30 sec
Per question
5:08
Average time
4.0
Contest Score
4.0
Community Rating
15
Participants
16 comments
Smart Tiger judge
This test may have a higher chance of receiving a reward. Nominated for:

Educational explanations. 👍 Explanations cover why the correct answers are correct and why the wrong answers are wrong (when appropriate). E.g.: #q1, #q2, #q3 etc
Calm Quokka
This quiz is good but has some minor mistakes :

Wrong question form :
question : Hos is defined the header of a function?
correct way is : How is the header of a function defined?

Mispelled word in option :
In correct answer of question : What is a generator?
iterator is mispelled as interator

Wrong question grammar form :
How do you can get the keys and the values of a dictionary `d`?
Sharp Squirrel author
Thank you so much for your suggestions!
Small Lizard
What is a generator?
Generators are iterators, that you can use once.
Yes, but generators are also objects. And their type is generator too.
So correct answers are: "An object type", "A special object", "Something that mimes an interator"
Sharp Squirrel author
That makes sense to me, I'll add your suggestion when I can edit the quiz, thanks!
Small Lizard
Which is the builtin command to check the type of a variable?
"isinstance is the preferred method to check the type of an object because it takes subclasses into account", but question doesn't say that we need to take subclasses into account, so "type" is correct answer too (maybe even more correct than isinstance)
Sharp Squirrel author
The question is tricky because I would suggest that type is used for other things... maybe I have to change that question to avoid misunderstanding.
Small Lizard
Which is the slice that took the elements from the 5th to 9th of a list l?
Indexes in a Python list start from 0, yes.
You say that indices in the question (5th and 9th) start from 1. I thought that they start from 0. I don't know which meaning is correct. Can you prove that your?
Sharp Squirrel author
I do not refer to the index, but to the element position. So, the elements of l will be:
[1st, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th, 9th, 10th, ...]
, with index [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...]. As a result, to select from the 5th to the 9th you need the indexes from 4 to 8 and that's why you have a slice [4:9].
Small Lizard
Sharp Squirrel I understand but I think that this should be pointed in the question.
Sharp Squirrel author
Small Lizard Ok, I'll make it explicit when I can edit the question.
Small Lizard
What can you return from a function?
What is the difference between "Any Python object" and "Any result of a Python expression"? I think that there is no difference, and both answers are correct
Sharp Squirrel author
Syntactically, the correct answer is a Python expression: https://docs.python.org/3/reference/simple_stmts.html#grammar-token-return-stmt
Small Lizard
Sharp Squirrel Do you mean this line?
return_stmt ::= "return" [expression_list]
Yes, we need to write "expression" after "return". This "expression" evaluates and becomes "Any result of a Python expression". But also, when "expression" evaluates, it becomes "Any Python object". So I still think that these options are identical
Sharp Squirrel author
Small Lizard I understood your point. I wanted to be faithful to the definition, but I think it is better to remove this misunderstanding...
Sharp Squirrel author
I just want to thanks all the commenters and say that I modified the quiz with the proposed changes
Take the quiz to leave a comment