Python Exercises Work Sheet
Python Exercises Work Sheet
Practice 1
Create a program that asks the user to enter their name and their age. Print out a message
addressed to them that tells them the year that they will turn 100 years old.
Practice 2
And write a program that prints out all the elements of the list that are less than 20.
Lists
More conditionals (if statements)
Practice 3
Ask the user for a string and print out whether this string is a palindrome or not.
(A palindrome is a string that reads the same forwards and backwards.)
List indexing
Strings are lists
Practice 4
Make a two-player Rock-Paper-Scissors game. (Hint: Ask for player plays (using input), compare
them, print out a message of congratulations to the winner, and ask if the players want to start
a new game)
While loops
Infinite loops
Break statements
Practice 5
Write a program (function!) that takes a list and returns a new list that contains all the
elements of the first list minus all the duplicates.
Sets
Functions