Coding Task: 02.03 Thumbs up, Thumbs Down

In this exercise, you will write a program that increases and decreases a number of likes based on user input in a looping menu. Some of the code has been written for you!

Your Task

In the editor below, fill in the blanks (________) so that the program behaves like the example screenshot below.

Python Reference Sheet

Remember to use the Python reference sheet to help you with your code! Click on one of the buttons below:

Requirements

  • The program should run without any errors.
  • The program should ask for a starting number of likes. It should then present a simple menu where the user can type a to increase the number of likes by one or b to decrease the likes by one. The program never ends.
  • Hint: Don’t forget to convert the likes variable to an integer using the int() command, or you might get an error! What happens when you don’t convert the variable to an integer? Why do you think this happens?

Example

Below is an example of how the program should run:

Starting likes: 4
Current likes:
4
a. for thumbs up
b. for thumbs down
Enter your choice: a

Current likes:
5
a. for thumbs up
b. for thumbs down
Enter your choice: b

Current likes:
4
a. for thumbs up
b. for thumbs down
Enter your choice: b

Current likes:
3
a. for thumbs up
b. for thumbs down
Enter your choice: 
Scroll to Top