Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 ". (Hint: Use the while loop, len function, if statement)

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

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Oracle 10g Database Administrator Implementation And Administration

Authors: Gavin Powell, Carol McCullough Dieter

2nd Edition

1418836656, 9781418836658

More Books

Students also viewed these Databases questions

Question

Find dy/dx if x = te, y = 2t2 +1

Answered: 1 week ago