
Exercises
Unit 1
-
Print your name on one line and your favorite food on another
-
Store your age in a variable and print it
-
Ask the user for their favorite movie and print a response
-
Ask for a number and print the number plus five, or do any other operations
-
Ask for name and age, then print a formatted greeting using f-strings
Unit 3
-
Ask for a number and print whether it is positive or negative
-
Ask for age and print "child", "teen", or "adult"
-
Ask for test core and print a letter grade
-
Compare 3 numbers and print the largest and smallest
Unit 5
-
Create a list of 4 favorite foods and print them out one by one
-
Ask the user for 3 numbers and store them in a list
-
Print the largest and smallest numbers in a list (without max() and min())
-
Count how many items in a list are even
Unit 7
-
Write a function that prints "Hello!"
-
Write a function that adds 2 numbers
- Write a function that gives the square of a number
- Call a function and store its return value
Unit 9
-
Write your name to a file
-
Read and print the contents of a file
-
Write multiple lines to a file using a loop
Unit 2
-
Ask for two numbers and print their sum, difference, product, and quotient
-
Ask for a price and tax rate, then calculate the cost
-
Use // and % to divide a number
Unit 4
- Ask for a word and print its length
- Print the first and last character of a string
- Reverse a string
- Convert a sentence to all lowercase and uppercase
- Replace all spaces with dashes in a string
Unit 6
-
Print numbers from 1 to 10
-
Print only even numbers from 1 to a number the user gives
-
Use a while loop to count down from 10
-
Ask the user for numbers until they type stop
-
Print the first 10 Fibonacci numbers
Unit 8
-
Create a dictionary for a student (name, age, grade, etc.)
-
Print all keys in a dictionary
-
Update a value in a dictionary
-
Loop through a dictionary and print key-value pairs