Module 1: Exercises and Quiz
·Programming

Module 1: Exercises and Quiz

Test your knowledge of Python fundamentals with these practical exercises and a module-wide quiz.

Module 1 Recap: Exercises and Quiz

Congratulations! You’ve reached the end of Module 1: Programming Fundamentals with Python. Before we move on to the next level, it’s important to test your muscle memory.


Part 1: Hands-on Exercises

Exercise 1: Logic Translation

Convert the following logic into a Python script:

  • Ask the user for their wallet balance.
  • Ask for the price of an item.
  • If they can afford it, print: "Purchase successful! Remaining balance: [Amount]"
  • If they can't afford it, print: "Insufficient funds. You need [Missing Amount] more."

Exercise 2: The Debugging Challenge

The following code has 3 errors. Copy and fix it:

x = 10
y = "20"
if x < y
print("X is smaller")

Exercise 3: Loop Master

Write a program that prints all even numbers between 1 and 20 using a for loop and an if statement.


Part 2: Module 1 Quiz

Read the questions below and try to answer them without looking back at the previous lessons.

1. Which of these is a valid variable name? A) 2nd_place B) total value C) _final_score D) price$

2. What is the result of 10 % 3? A) 3 B) 1 C) 0 D) 3.33

3. How do you start a for loop that runs exactly 10 times? A) for i in 10: B) for i in range(10): C) loop 10 times: D) for(10):

4. What does the float() function do? A) Makes a variable "float" to the top of the code. B) Converts a value to a decimal number. C) Converts a value to a whole number. D) Deletes a variable from memory.

5. Which symbol is used for an "And" logical operation? A) & B) && C) and D) both


Answer Key

  1. C (Starts with underscore, no spaces/special chars).
  2. B (10 divided by 3 is 3 with a remainder of 1).
  3. B (range starts at 0 and goes up to 9).
  4. B (Integers or strings to decimals).
  5. C (Python uses plain English for logic).

What’s Next?

You’ve mastered the basics! Now it’s time to learn how to organize large amounts of information efficiently.

Get ready for Module 2: Data Structures and Algorithms, where we’ll dive into Lists, Dictionaries, and the secrets of efficient coding!

Subscribe to our newsletter

Get the latest posts delivered right to your inbox.

Subscribe on LinkedIn