Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4.5 Stay under 80 characters on all code and comment lines Ask for input() with descriptive prompts telling users what is expected o Especially remember

4.5 Stay under 80 characters on all code and comment lines Ask for input() with descriptive prompts telling users what is expected o Especially remember to tell user what delimiter youre expecting when using split() Make sure to validate user input for data type, value range and other problem requirements Print output that clearly explains what is being printed (where necessary) o In other words, dont just print a 5 unless its clear what that 5 represents. Import statements should be immediately after the program docstring Make sure to include # line comments (just a few in each program, dont go crazy) Use snake_case (lower case plus underscores) for variables CONSTANT variables must be all upper case and immediately following any import statements Do NOT create user defined functions for this assignment. Only base python functions and methods can be used, along with those in the modules listed below. Modules Allowed You may only import the following modules into your programs and use their methods and attributes, unless first receiving special (and unlikely) permission from your facilitator: math operator os re string sys THE question is

4.5: Create a program that: a. creates a constant dictionary with keys for the characters 1234567890-. and values that represent these characters as words. For the decimal point, use point as the value For the negative sign, use negative as the value b. inside of an infinite loop prompts a user for a number with an appropriate description validates that a number was entered if valid - break out of the loop otherwise print error message and stay in loop to reprompt c. convert the validated number to words using the dictionary created in step a. d. print the converted number words with an appropriate description Notes: The program must only have one input function and work for any size number. If the user enters commas, tell them to try again without the commas. Example Output #1 Enter a number: 123 As Text: One Two Three Example Output #2 Enter a number: -123 As Text: Negative One Two Three Example Output #3 Enter a number: 1234.76 As Text: One Two Three Four Point Seven Six Example Output #4 invalid Input Enter a number: 1,000 Please try again without entering commas. Enter a number: 1 thousand "1 thousand" is not a valid number. Please try again Enter a number: 1000.00 As Text: One Zero Zero Zero Point Zero Zero

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

Visual Basic6 Database Programming

Authors: John W. Fronckowiak, David J. Helda

1st Edition

ISBN: 0764532545, 978-0764532542

More Books

Students also viewed these Databases questions

Question

What is one of the skills required for independent learning?Explain

Answered: 1 week ago