Python - Section 4 Practice Tasks

Task One

Create a very simple Spanish translation program.

 

Let the user enter a number between one and four (“one”, “two”, “three” or “four”).

 

If they enter “one” then print “uno”, else if (elif) they enter “two” then print “dos”, else if they enter “three” print “tres” and for “four” print “cuatro”.

 

If they enter anything else print “I don’t know any more Spanish!”.

Example solution:

Task Two

Create a program where the user enters their age.

 

If the value that they have entered is 18 or over then print the sentence “You can legally vote!” but if any other value is entered then print “You are too young to vote!”.

Example solution:

Task Three

Create a program that asks the user their name.

 

If their name is Craig or David then print “What’s your flavour?” otherwise print “Hello” and their name.

Example solution:

Task Four

Ask the user to enter a first number and then a second number.

 

Multiply the two numbers together.

 

If the total is more than 9000 print “IT’S OVER 9000!!!”, else print the total.

+

Example solution:

© CSNewbs 2019