Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

How can I write a code for the question in simple python language [10 marks] Write a function named get_choice that takes no parameters. This

How can I write a code for the question in simple python language image text in transcribed
[10 marks] Write a function named get_choice that takes no parameters. This function asks the user to enter a number between 1 and 5 . It must perform error checking to accept only integers between 1 and 5 (inclusive). When an allowed number is entered, it returns that number. The following example shows the expected wording and formatting: 1>>> [evaluate Lab1_JC.py] 2>>> get_choice() Select option (1 to 5): a Invalid option. Please enter a number between 1 and 5: a Invalid option. Please enter a number between 1 and 5: ? Invalid option. Please enter a number between 1 and 5: Invalid option. Please enter a number between 1 and 5: 3.4 Invalid option. Please enter a number between 1 and 5: 0 Invalid option. Please enter a number between 1 and 5: 6 Invalid option. Please enter a number between 1 and 5: 2 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started