In a make task you use the skills you have learned to create a program from scratch. There is no starter code: you begin with an empty editor.
You are going to write the INSULT-O-MATIC 5000. It asks for a name and a number, and fires back one very mild insult. The insults below are the ones the machine has been loaded with, and they are all firmly on the silly side.
print, exactly as written below, followed by
an input() on the next line.int(). The name
stays as it is, because it is text.if for the first number, an elif for each of the four that follow
it, and an else for any number that is not between 1 and 5.Ask the two questions with their own print, exactly as written, in this
order:
What is your name?Pick a number between 1 and 5:Both questions are part of the checked output, so spelling, capital letters and punctuation count.
The five insults are fixed, so that the output can be checked automatically.
NAME stands for whatever the user typed as their name. The first line below
belongs to number 1, the second to 2, and so on down to 5:
NAME, your socks never match and everybody knows it.
NAME, you clap when the plane lands.
NAME, you put pineapple on everything, even toast.
NAME, you wave back at people who were waving at someone behind you.
NAME, you laugh at your own jokes before you get to the end of them.
If the number is not one of 1, 2, 3, 4 or 5, the machine gives up and
prints this line instead:
That is not a number between 1 and 5, NAME.
Every line ends with a full stop, and the name is followed by a comma in the five insults. Copy the wording exactly.
Input:
Andy
1
Output:
What is your name?
Pick a number between 1 and 5:
Andy, your socks never match and everybody knows it.
Input:
Ravi Patel
3
Output:
What is your name?
Pick a number between 1 and 5:
Ravi Patel, you put pineapple on everything, even toast.
Input:
Priya
0
Output:
What is your name?
Pick a number between 1 and 5:
That is not a number between 1 and 5, Priya.
Make sure that you check for the following things:
if, has as many elif branches in the middle as you
need, and ends with else.if, elif and else line.if, elif and else lines themselves are not indented.if and each elif.else.==) in each condition. A single =
stores data in a variable.int(), or it is compared as text and no branch ever
matches.int(): it stays a string.+ between each string and variable that needs concatenating.