Python Quizzes
The best way to learn to code is to practice.
Improve your Python programming skills with our quizzes.
We have put together different questions for each skill level.
Quiz – Python Basics Part 1
The quiz contains 17 questions and there is no time limit. You can get between 1 and 3 points for answering the questions correctly. At the end of the quiz, you'll receive a total score. You can compare yourself with other users via the leaderboard. If you achieve more than 70% you will be rewarded with a certificate. Good luck!
Test your understanding of the basics of Python programming language: - Data types and variables - Input / Output - Arithmetic operators - Relational operators - Logical operators - Bitoperators
Quiz Summary
0 of 17 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 17 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Average score |
|
Your score |
|
Categories
- Not categorized 0%
Pos. | Name | Entered on | Points | Result |
---|---|---|---|---|
Table is loading | ||||
No data available | ||||
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
-
Question 1 of 17
1. Question
1 point(s)What is the correct syntax to output
My first Python program
?CorrectIncorrect -
Question 2 of 17
2. Question
1 point(s)How do you create a variable with a decimal value of 4.6 in Python?
CorrectIncorrectHint
Variables are initialized in python without keyword.a = 4,6b = 4.6print(type(a)) –> <class ‘tuple’>print(type(b)) –> <class ‘float’> -
Question 3 of 17
3. Question
1 point(s)What is the data type of variable
a
?a = True print(type(a))
CorrectIncorrect -
Question 4 of 17
4. Question
1 point(s)What is the output?
print(2, 3 - 1, 5)
CorrectIncorrect -
Question 5 of 17
5. Question
1 point(s)What is the output?
print(2_3*4)
CorrectIncorrect -
Question 6 of 17
6. Question
2 point(s)What is the output?
x = input("Please enter a number: ") # input: 4.4 print(isinstance(x, float))
CorrectIncorrect -
Question 7 of 17
7. Question
2 point(s)What is the output for
y
?x = input("Please enter something: ") # input: 5 print(isinstance(x, str))
CorrectIncorrect -
Question 8 of 17
8. Question
1 point(s)What is the output?
def fun(): return 2.5 + int(10.8) print(fun())
CorrectIncorrect -
Question 9 of 17
9. Question
1 point(s)What is the output?
x = input("Please enter number: ") 4 y = input("Please enter number: ") 9 print(x + y)
CorrectIncorrect -
Question 10 of 17
10. Question
1 point(s)What is the output?
x = int(input("Please enter number: ")) 4 y = int(input("Please enter number: ")) 9 result = x + y print(result)
CorrectIncorrect -
Question 11 of 17
11. Question
1 point(s)What is the output for
result
?a, b, c = 55, 20, 4 result = a % b % c print(result)
CorrectIncorrect -
Question 12 of 17
12. Question
1 point(s)What is the output?
for i in range(3): i = i + 1 print(i, end=" ") for i in range(1, 4): print(i, end=" ")
CorrectIncorrect -
Question 13 of 17
13. Question
1 point(s)Which operator can be used to check two values for equality?
CorrectIncorrect -
Question 14 of 17
14. Question
1 point(s)What is the output for
isSet
?x, y, z = 2, 6, 6 isSet = False if x < z and y >= z and x > z or isSet == False: isSet = True print(isSet)
CorrectIncorrect -
Question 15 of 17
15. Question
2 point(s)What is the output?
a, b, c = 100, 20, 50 if c > b < a: print("True") else: print("False")
CorrectIncorrect -
Question 16 of 17
16. Question
3 point(s)What is the output for
x
?a, b, c = 9, 12, 4 x = a | b print(x)
CorrectIncorrect -
Question 17 of 17
17. Question
1 point(s)What is the output for
y
?a, b, c = 9, 13, 2 y = a ^ c print(y)
CorrectIncorrect
Quiz – Python Basics Part 2
The quiz contains 13 questions and there is no time limit. You can get between 1 and 3 points for answering the questions correctly. At the end of the quiz, you'll receive a total score. You can compare yourself with other users via the leaderboard. If you achieve more than 70% you will be rewarded with a certificate. Good luck!
Test your understanding of the basics of Python programming language: - Comments - Escape sequences - Data types - Operators - Control structures - Methods - Arrays
Quiz Summary
0 of 13 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 13 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Average score |
|
Your score |
|
Categories
- Not categorized 0%
Pos. | Name | Entered on | Points | Result |
---|---|---|---|---|
Table is loading | ||||
No data available | ||||
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
-
Question 1 of 13
1. Question
1 point(s)Which is the correct way to write a comment in Python?
CorrectIncorrect -
Question 2 of 13
2. Question
1 point(s)Which is the correct way to write a multi line comment in Python?
CorrectIncorrect -
Question 3 of 13
3. Question
1 point(s)What is the output?
a, b = 5, 9 if a >= b: print(a) else: print(b)
CorrectIncorrect -
Question 4 of 13
4. Question
1 point(s)What is the output?
a, b, c = 4, 6, 0 while c < 11: if a < b: a += 1 c += 5 else: c += 4 print(c)
CorrectIncorrect -
Question 5 of 13
5. Question
1 point(s)What is the output for
c
?s = "Hello World" c = 0 for i in s: c += 1 print(c)
CorrectIncorrect -
Question 6 of 13
6. Question
1 point(s)What is the output?
print(3, 4 + 6, 8)
CorrectIncorrect -
Question 7 of 13
7. Question
1 point(s)What is the output?
print(2_6 * 2)
CorrectIncorrect -
Question 8 of 13
8. Question
1 point(s)What is the output?
x, y, z = 5 print(x, y, z)
CorrectIncorrect -
Question 9 of 13
9. Question
1 point(s)What is the output?
x = "XYC" newString = x.replace("XY", "AB") print(newString)
CorrectIncorrect -
Question 10 of 13
10. Question
2 point(s)What is the output?
x = "ABCDEFGH" newString = x.replace("GH", "XX") newString = newString.replace("ABD", "XYC") print(newString)
CorrectIncorrect -
Question 11 of 13
11. Question
1 point(s)What is the output?
a, b = 0, 0.0 print(True if a == b else False)
CorrectIncorrect -
Question 12 of 13
12. Question
2 point(s)Which one can not be a variable name?
CorrectIncorrect -
Question 13 of 13
13. Question
1 point(s)What is the output?
x = 2 * 4 // 2 y = 5 // 2 * 4 print(x, y)
CorrectIncorrect
Quiz – Python Functions
The quiz contains 4 questions and there is no time limit. You can get between 1 and 3 points for answering the questions correctly. At the end of the quiz, you'll receive a total score. You can compare yourself with other users via the leaderboard. If you achieve more than 70% you will be rewarded with a certificate. Good luck!
Test your understanding of functions: - Basics - Function Parameters - Recursion - Nested Functions
Quiz Summary
0 of 4 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 4 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Average score |
|
Your score |
|
Categories
- Not categorized 0%
Pos. | Name | Entered on | Points | Result |
---|---|---|---|---|
Table is loading | ||||
No data available | ||||
- 1
- 2
- 3
- 4
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
-
Question 1 of 4
1. Question
1 point(s)What is the output?
def add(x = 10): print(str(x + 1)) add(21)
CorrectIncorrect -
Question 2 of 4
2. Question
2 point(s)What is the output?
def fun(a, b): print(type(b)) fun(['a', (10, 20, 30)], 7.7)
CorrectIncorrect -
Question 3 of 4
3. Question
2 point(s)What is the output for
type(a)
?def fun(a, b): print(type(a)) fun(['a', (10, 20, 30)], 7.7)
CorrectIncorrect -
Question 4 of 4
4. Question
1 point(s)What is the output?
def fun(a): def add(b): return a + b return add print(fun(4)(8))
CorrectIncorrect
Quiz – Python Mathematical Functions
The quiz contains 7 questions and there is no time limit. You can get between 1 and 3 points for answering the questions correctly. At the end of the quiz, you'll receive a total score. You can compare yourself with other users via the leaderboard. If you achieve more than 70% you will be rewarded with a certificate. Good luck!
Test your skills for mathematical functions: - Basic mathematical functions - Exponential and logarithmic mathematical functions - Mathematical rounding - Power math function - Square math function
Quiz Summary
0 of 7 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 7 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Average score |
|
Your score |
|
Categories
- Not categorized 0%
Pos. | Name | Entered on | Points | Result |
---|---|---|---|---|
Table is loading | ||||
No data available | ||||
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
-
Question 1 of 7
1. Question
What is the output for
floor
?import math val = 2.45678 floor = math.floor(val) print(floor)
CorrectIncorrect -
Question 2 of 7
2. Question
What is the output for
ceil
?import math val = 2.45678 ceil = math.ceil(val) print(ceil)
CorrectIncorrect -
Question 3 of 7
3. Question
What is the output for
round
?import math val = 2.45678 round = round(val, 3) print(round)
CorrectIncorrect -
Question 4 of 7
4. Question
What is the output for
pow
?import math pow = math.pow(4, 3) print(pow)
CorrectIncorrect -
Question 5 of 7
5. Question
What is the output for
sqrt
?import math sqrt = int(math.sqrt(625)) print(sqrt)
CorrectIncorrect -
Question 6 of 7
6. Question
What is the output for
pow
?import math pow = pow(4, 3, 5) print(pow)
CorrectIncorrectHint
4^3 % 5
64 / 5 = 12 Rest 4
-
Question 7 of 7
7. Question
What is the output for
floor
?import math val = 345.234 floor = math.floor(val) print(floor)
CorrectIncorrect
Quiz – Python Lists
The quiz contains 6 questions and there is no time limit. You can get between 1 and 3 points for answering the questions correctly. At the end of the quiz you will receive a total score. You can compare yourself with other users via the leaderboard. If you achieve more than 70% you will be rewarded with a certificate. Good luck!
Test your understanding of lists: - Lists Basics - List Methods - Add and delete List Elements - Other List Operations
Quiz Summary
0 of 6 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 6 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Average score |
|
Your score |
|
Categories
- Not categorized 0%
Pos. | Name | Entered on | Points | Result |
---|---|---|---|---|
Table is loading | ||||
No data available | ||||
- 1
- 2
- 3
- 4
- 5
- 6
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
-
Question 1 of 6
1. Question
1 point(s)What is the output?
myList = [2, "STR", 5.5] print(myList[1])
CorrectIncorrect -
Question 2 of 6
2. Question
1 point(s)What is the output?
myList = [2, 4, 5, 9, 2, 6, 1] print(myList[1] + myList[4] + myList[5])
CorrectIncorrect -
Question 3 of 6
3. Question
1 point(s)What is the output?
myList = [2, 4.9, 5.5, 2.1] print(myList[0] + int(myList[1]) + myList[3])
CorrectIncorrect -
Question 4 of 6
4. Question
1 point(s)What is the output?
myList = [1, 2, 3, 4, 5] myList.pop(0) myList.append(6) for i in myList: print(i, end=" ")
CorrectIncorrect -
Question 5 of 6
5. Question
1 point(s)What is the output?
myList = [1, 2, 3, 3, 3, 5, 5, 6, 5, 3] print(myList.count(5), myList.count(3))
CorrectIncorrect -
Question 6 of 6
6. Question
1 point(s)What is the output?
myList = [10, 14, 55, 23, 85, 22, 12] print(myList.index(23))
CorrectIncorrect
Quiz – Python Inheritance and Polymorphism
The quiz contains 8 questions and there is no time limit. You can get between 1 and 3 points for answering the questions correctly. At the end of the quiz, you'll receive a total score. You can compare yourself with other users via the leaderboard. If you achieve more than 70% you will be rewarded with a certificate. Good luck!
Test your understanding of inheritance and polymorphism: - Single inheritance - Multiple inheritance - Multilevel inheritance - Hierarchical inheritance - Function polymorphism - Class polymorphism
Quiz Summary
0 of 8 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 8 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Average score |
|
Your score |
|
Categories
- Not categorized 0%
Pos. | Name | Entered on | Points | Result |
---|---|---|---|---|
Table is loading | ||||
No data available | ||||
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
-
Question 1 of 8
1. Question
1 point(s)What is the output?
class Animal: def printAnimal(self): print("This is an Animal") class Dog(Animal): def printDog(self): print("This is a Dog") obj = Dog() obj.printDog()
CorrectIncorrect -
Question 2 of 8
2. Question
1 point(s)What is the output?
class Animal: def printAnimal(self): print("This is an Animal") class Dog(Animal): def printDog(self): print("This is a Dog") obj = Dog() obj.printAnimal()
CorrectIncorrect -
Question 3 of 8
3. Question
1 point(s)What is the output?
class Animal: def printAnimal(self): print("This is an Animal") class Dog(Animal): def printDog(self): print("This is a Dog") obj = Animal() obj.printDog()
CorrectIncorrect -
Question 4 of 8
4. Question
1 point(s)What is the output?
class First: def outputFirst(self): print("First class") class Second: def outputSecond(self): print("Second class") class Third(First, Second): def outputThird(self): print("Third class") third = Third() third.outputFirst()
CorrectIncorrect -
Question 5 of 8
5. Question
1 point(s)What is the output?
class First: def outputFirst(self): print("First class") class Second: def outputSecond(self): print("Second class") class Third(First, Second): def outputThird(self): print("Third class") third = Third() third.outputFirst() third.outputSecond() third.outputThird()
CorrectIncorrect -
Question 6 of 8
6. Question
1 point(s)What is the output?
class First: def outputFirst(self): print("First class") class Second(First): def outputSecond(self): print("Second class") class Third(Second): def outputThird(self): print("Third class") second = Second() second.outputFirst() second.outputSecond() second.outputThird()
CorrectIncorrectHint
AttributeError: ‘Second’ object has no attribute ‘outputThird’
-
Question 7 of 8
7. Question
1 point(s)What is the output?
class First: def outputFirst(self): print("First class") class Second(First): def outputSecond(self): print("Second class") class Third(First): def outputThird(self): print("Third class") third = Third() third.outputFirst()
CorrectIncorrect -
Question 8 of 8
8. Question
1 point(s)What is the output?
class First: def outputFirst(self): print("First class") class Second(First): def outputSecond(self): print("Second class") class Third(First): def outputThird(self): print("Third class") third = Third() third.outputSecond()
CorrectIncorrectHint
AttributeError: ‘Third’ object has no attribute ‘outputSecond’
Quiz – Python Advanced
The quiz contains 6 questions and there is no time limit. You can get between 1 and 3 points for answering the questions correctly. At the end of the quiz, you'll receive a total score. You can compare yourself with other users via the leaderboard. If you achieve more than 70% you will be rewarded with a certificate. Good luck!
Test your advanced skills of the Python programming language: - Python Syntax - Advanced control structures - Classes and objects - Data abstraction - Functions
Quiz Summary
0 of 6 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 6 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Average score |
|
Your score |
|
Categories
- Not categorized 0%
Pos. | Name | Entered on | Points | Result |
---|---|---|---|---|
Table is loading | ||||
No data available | ||||
- 1
- 2
- 3
- 4
- 5
- 6
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
-
Question 1 of 6
1. Question
1 point(s)Python is strongly typed!
CorrectIncorrect -
Question 2 of 6
2. Question
1 point(s)Python is statically typed!
CorrectIncorrect -
Question 3 of 6
3. Question
1 point(s)Python is a type-safe language!
CorrectIncorrect -
Question 4 of 6
4. Question
2 point(s)What is the output?
def fun(a, b): if a == 0: return b else: return a + fun(a - 2, b) print(fun(4,6))
CorrectIncorrect -
Question 5 of 6
5. Question
2 point(s)What is the output?
class Test(): def __init__(self): self.__priv = "A" self._prot = "B" self.pub = "C" t = Test() print(t.__priv, end=', ') print(t._prot, end=', ') print(t.pub)
CorrectIncorrectHint
AttributeError: ‘Test’ object has no attribute ‘__priv’
-
Question 6 of 6
6. Question
1 point(s)What is the output?
class Test(): def __init__(self): self.__priv = "A" self._prot = "B" self.pub = "C" t = Test() print(t._prot, end=', ') print(t.pub)
CorrectIncorrect