0% found this document useful (0 votes)
35 views2 pages

Python Exercises Work Sheet

The document contains instructions for 5 Python exercises that teach various programming concepts like getting user input, working with lists and conditionals, strings, loops, and functions. The exercises include calculating a user's 100th birthday, printing list elements under 20, checking for palindromes, making a Rock-Paper-Scissors game, and removing duplicates from a list.

Uploaded by

michael
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views2 pages

Python Exercises Work Sheet

The document contains instructions for 5 Python exercises that teach various programming concepts like getting user input, working with lists and conditionals, strings, loops, and functions. The exercises include calculating a user's 100th birthday, printing list elements under 20, checking for palindromes, making a Rock-Paper-Scissors game, and removing duplicates from a list.

Uploaded by

michael
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

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.

Concepts for this practice:

 Getting user input


 Manipulating strings

Practice 2

Take a list, say for example this one:


a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]

And write a program that prints out all the elements of the list that are less than 20.

Concepts for this practice:

 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.)

Concepts for this practice:

 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)

Concepts for this practice:

 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.

Concepts for this practice:

 Sets
 Functions

You might also like