Python knowledge
English
Basic
A test that will test you python skills. Basic questions in the beginning.
Description
Tags
30
Questions
30 sec
Per question
4:08
Average time
4.0
Contest Score
12
Participants
15 comments
Holy Duck judge
This test may have a higher chance of receiving a reward. Nominated for:
Holy Duck 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
Calm Quokka
Quiz is good but it has following mistakes -

1. Wrong answer and explanation - Following question has wrong answer and explanation

import math
a = 2*3
print (a) What is the output

Given ans is 8 but actual ans is 6. It simply multiplies, not calculate exponent.
-----------------------------

2. question error - following code must contain colon at end of first line; followed by indentation in next line.

for a in range(0,5)
pass
print (a) What is the output of this code?

-----------------------------

3. question error - there must be line break before num for following question .
list1 = [1,2,3]
list2 =[4,5,6]
list1.append(list2) num= len(list1) The value of num is

-----------------------------

4. question error - indentation required at line 2,3
for I in range(0,5):
if I%2==0:
print("even") else: print("odd") How many times odd and even will be printed

-----------------------------

(Also at some question last line of question which must be in separate new line happens to be in same line in continuation to last line of code. But I checked it in Telegram Quiz Bot and found that even after giving new line it does not show at those positions, so I am not pointing it as mistake.)
Calm Piranha author
I gave all the indentation and line breaks but due to issues of telegram the indentation was not present in the questions. I will accept first 2 mistake only
Small Lizard
You can use pre-poll message: text message with pre-formatted fixed-width code block or image (see https://telegram.org/tour/quizbot#creating-a-quiz-step-by-step,
Creating a Quiz, Step-By-Step, second point). Then you can write indentation and more than 3 lines.
Calm Piranha author
Small Lizard Thanks buddy for helping me
Small Lizard
for I in range(0,5):
if I%2==0:
print("even") else: print("odd") How many times odd and even will be printed
Your answer is "even-5 odd-5" but I think that answer is "even-3 odd-2" (even for 0, 2, 4 and odd for 1, 3). Check this link: https://ideone.com/gAELG9
I read your explanation but I don't understand what do you mean.
Calm Piranha author
Thanks for feedback. I will check this one out
Small Lizard
A class name must be
Your answer is "Start with uppercase letters" but, as you said in explanation, "It is not necessary". Yes, it will be better if class name starts with uppercase letter but question was "A class name MUST be". So I think that correct answer is "no limitations".
Calm Piranha author
you see convention are something that has no impact on results but still important to follow that's why. Atleast you get information about camelcase convention. I accept your explanation. Got to be careful about clarifying things in question.
Small Lizard
What will happen if you append multiple value in list using append()
Your answer is "Error will occur"
I can append multiple value in list using append() in this way:
a.append(1)
a.append(2)
Then they will be appended: https://ideone.com/OQm9un
If you meant "a.append(1,2)", you should write something like "append multiple value in list using ONE CALL of append()". You didn't write this, so my code is also accepted and answer "they will be appended" is also correct.
Calm Piranha author
Append takes only one argument and when you will append multiple values at same time then error will occur. Yes you are correct that you can do it one by one but that's not what I was asking. Next time I will try to clarify my questions better. Thanks for giving feedback
Small Lizard
X,Y = 11,23
Y,X = X,Y
print (X) print (Y) What is the output of above code?
Your answer is "11 and 11", but correct answer is "23 and 11"
Simply running this code can prove my opinion: https://ideone.com/dZu6MI
Link to documentation: https://docs.python.org/3/tutorial/introduction.html#first-steps-towards-programming, 3.2. First Steps Towards Programming, first point
So "Y,X = X,Y" exactly swaps two variables
Cool Bear
I also checked this one and yes the correct is 23 and 11 : https://ideone.com/Hr1ANX
Calm Piranha author
Ok I Will Check this one. Thanks for feedback.
Take the quiz to leave a comment