Computer Science, asked by xyz1987, 16 days ago

Write a program using "if...elif...else..." to accept an integer between 1 and 5 from the user and display colour for respective integer as given below. If any other input is entered it should display a message "invalid input"
1- black
2- white
3- red
4- blue
5- green​

Answers

Answered by kuniswain03
1

Answer:

Write a program using "if...elif...else..." to accept an integer between 1 and 5 from the user and display colour for respective integer as given below. If any other input is entered it should display a message "invalid input"

1- black

2- white

3- red

4- blue

5- green

Answered by Gargeezade
4

Answer:

 answer = input("\nInput a number between 1 to 5: ")

num=float(answer)

if num == 5:

   print("colour is green")

elif num == 4:

   print("colour is blue")

elif num == 3:

   print("colour is red")

elif num == 2:

   print("colour is white")

elif num == 1:

   print("colour is black")

else:

   print("Invalid input")

Similar questions