Question
PYTHON : Two short codes 1. Input validation - Get a string from the user. Validate that the string length is between 2 and 5.
PYTHON: Two short codes
1. Input validation - Get a string from the user. Validate that the string length is between 2 and 5. if not, let the user know and ask them again. Keep asking until you get a valid string. Once you get a valid string, exit the loop and print "Success. We got
2. Input validation with error checking - Get a valid integer from the user between 3 and 9 and print it. Note that if the user enters a string, the code will throw an error when you try to cast it, that you will have to catch. If the user enters an invalid integer, let them know and ask again. Keep asking until you get a valid integer between 3 and 9. (Hint: You will use the while loop, casting, try/except, if statement)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started