CHALLENGES
It's time to put what you've learned in the workshop to the test!
Challenge 1: String Formatting
You'll have 2 minutes to write a program that does the following:
Using string formatting, write a program that outputs a string with your name and age to the console, e.g.:
"Hi! My name is Rob and I'm 19 years old."
You MUST use variables to store the values of your name and age.
Challenge 2: Conditional Statements
You'll have 10 minutes to write a program that does the following:
Gives the user an option to pick between three flavours of ice cream.
If the user doesn't select anything, the program will select a different flavour.
Outputs which flavour the user selected as a string, for example:
"You chose chocolate flavoured ice cream."
Extension
Let the user select more than one flavour of ice cream, by entering a string such as
"1 & 3"
or"2 & 1"
.Parse the inputted string, extracting the two numbers, and output a sentence informing the user of their flavour selections, for example:
"You chose chocolate and strawberry flavoured ice cream."
Challenge 3: Using Libraries
You'll have the remaining time in the workshop to write a program that does the following:
Gives the user an option to pick between drawing three shapes, e.g. a triangle, square and circle.
Draw the selected shape.
If the user doesn't select anything, the program will draw a straight line.
Extension
Give the user another option to draw the first letter of your name!
Last updated
Was this helpful?