← Back to Python Basics
Module 1

Exercises

Practice what you've learned with hands-on coding exercises

Complete these exercises to reinforce your understanding of Python Basics. Try to solve them on your own before checking the solutions!

Exercise 1: Personal Information

Easy

Create a program that asks for user's name, age, and city, then displays a formatted message with all the information.

💡 Hints
  • Use the input() function to get user data
  • Store each piece of information in a variable
  • Use f-strings to format the output message

Exercise 2: Basic Calculator

Easy

Build a simple calculator that takes two numbers and an operator (+, -, *, /) and performs the calculation.

💡 Hints
  • Get two numbers from user input and convert to float
  • Get the operator as a string
  • Use if-elif statements to perform the right operation

Exercise 3: Temperature Converter

Easy

Convert temperatures between Celsius and Fahrenheit. Formula: F = C * 9/5 + 32

💡 Hints
  • Ask which conversion direction (C to F or F to C)
  • Get the temperature value
  • Apply the appropriate formula

Exercise 4: String Manipulation

Medium

Take a sentence from the user and display: word count, character count, uppercase version, lowercase version, and title case version.

💡 Hints
  • Use .split() to count words
  • Use len() for character count
  • Use string methods like .upper(), .lower(), .title()

Exercise 5: Shopping Cart Total

Medium

Calculate the total cost of items in a shopping cart including tax. Ask for item prices and calculate subtotal, tax (8%), and total.

💡 Hints
  • Store prices in variables
  • Calculate subtotal by adding all prices
  • Calculate tax as 8% of subtotal
  • Add subtotal and tax for total

Ready to check your work?

View the solutions to see how you did and learn best practices.

View Solutions