1
python-logo

Python quiz – Beginner

Test your Pythonic knowledge with our beginner-level Python quiz!

1 / 20

How do you compare two values?

2 / 20

What is the output of the following code:

  • var = “James” * 2 * 3
  • print(var)

3 / 20

What is the correct syntax to call a superclass method in Python?

4 / 20

What is the correct syntax to create a class in Python?

5 / 20

What is the output of the following code

  • for x in range(0.5, 5.5, 0.5):
    • print(x)

6 / 20

What is the output of the following code:

  • a, b, c = 10, 20, 30
  • print(a, b, c)

7 / 20

What is the correct syntax to format a string?

8 / 20

How do you import a module in Python?

9 / 20

What does the keyword ‘continue’?

10 / 20

What does the keyword ‘break’ do?

11 / 20

How do you call a function in Python?

12 / 20

What is the correct syntax to raise an exception in Python 3?

13 / 20

What is the correct syntax to check if an element is in a set in Python 3?

14 / 20

What is the correct syntax to add an element to a set in Python?

15 / 20

What is the correct syntax to create a dictionary in Python?

16 / 20

How to iterate through a list in Python?

17 / 20

What is the correct syntax to create a list in Python?

18 / 20

How do you convert an integer to a float in Python?

19 / 20

What does the keyword ‘def’ do in Python 3?

20 / 20

How do you declare a variable called x with a value of 10 in Python?