top of page
Gradient Color Background

Exercises

Unit 1

  1. Print your name on one line and your favorite food on another

  2. Store your age in a variable and print it

  3. Ask the user for their favorite movie and print a response

  4. Ask for a number and print the number plus five, or do any other operations

  5. Ask for name and age, then print a formatted greeting using f-strings

Unit 3

  1. Ask for a number and print whether it is positive or negative

  2. Ask for age and print "child", "teen", or "adult"

  3. Ask for test core and print a letter grade

  4. Compare 3 numbers and print the largest and smallest

Unit 5

  1. Create a list of 4 favorite foods and print them out one by one

  2. Ask the user for 3 numbers and store them in a list

  3. Print the largest and smallest numbers in a list (without max() and min())

  4. Count how many items in a list are even

Unit 7

  1. Write a function that prints "Hello!"

  2. Write a function that adds 2 numbers

  3. Write a function that gives the square of a number
  4. Call a function and store its return value

Unit 9

  1. Write your name to a file

  2. Read and print the contents of a file

  3. Write multiple lines to a file using a loop

Unit 2

  1. Ask for two numbers and print their sum, difference, product, and quotient 

  2. Ask for a price and tax rate, then calculate the cost

  3. Use // and % to divide a number

Unit 4

  1. Ask for a word and print its length
  2. Print the first and last character of a string
  3. Reverse a string
  4. Convert a sentence to all lowercase and uppercase
  5. Replace all spaces with dashes in a string

Unit 6

  1. Print numbers from 1 to 10

  2. Print only even numbers from 1 to a number the user gives

  3. Use a while loop to count down from 10

  4. Ask the user for numbers until they type stop

  5. Print the first 10 Fibonacci numbers

Unit 8

  1. Create a dictionary for a student (name, age, grade, etc.)

  2. Print all keys in a dictionary

  3. Update a value in a dictionary

  4. Loop through a dictionary and print key-value pairs

bottom of page