Python Tutorial menu

Python Quiz

Check your Python knowledge with this quiz covering the whole tutorial.

How the Quiz Works

There are ten questions. Choose an answer for each one to see if it is correct, along with a short explanation. If you get one wrong, go back to that lesson and read it again.

QuestionsTopics
1 to 3Syntax, variables and data types
4 to 6Strings, operators and collections
7 to 10Loops, functions, classes and errors

Questions

Exercise

1. What will print(type(10 / 2)) show?

Exercise

2. Which of these creates a valid variable?

Exercise

3. What is the result of int("45") + 5?

Exercise

4. name = "Workownix". What is name[-3:]?

Exercise

5. Which collection does NOT allow duplicate values?

Exercise

6. prices = {"tea": 60}. How do you add a new item "coffee" with the value 150?

Exercise

7. What does list(range(1, 10, 3)) give?

Exercise

8. Which keyword sends a value back from a function?

Exercise

9. Inside a class, what does self refer to?

Exercise

10. Which exception does int("hello") raise?

What Next?

Scored 8 or more? You are ready for NumPy and Pandas. Scored less? Revisit the lessons on lists, loops and functions, then try again.

Learn Python with a teacher

Join the Python Programming course at Workownix, online or in Orangi Town, Karachi, and get a certificate.

See the course Ask on WhatsApp