Week 3: Take home exercises¶
What is your favorite color?¶
- Get input from the user using the input function
- Check to see if it’s a specific color
- Is the string the user provided equal to the string “blue” or the string “red”?
- If it is, tell the user something about it
- print out “{} is a super cool color!”
- Else, tell the user something different
- print out “{} is an ok color”
Bonus¶
- Make your menu two-levels. This requires a “nested if”.
- Use random to have a dice roll be one of the options.
1 2 3 4 | import random
random_number = random.randint(0, 6) # a random number between 0 and 6 (includes 0, doesn't include 6)
random_number = random.randint(1, 7) # a random number between 1 and 7 (includes 1, doesn't include 7)
|
- Have a menu option be to input a word and turn it into pig latin.