Question
Data programming: Python ->import sys and argv. NOT INPUT FUNCTION. (2.^ from picture above) Rewrite the previous program using try and except so that your
Data programming: Python ->import sys and argv. NOT INPUT FUNCTION.
(2.^ from picture above)
Rewrite the previous program using try and except so that your program handles non-numeric inputs gracefully by printing a message and exiting the program. The following shows two executions of the program with invalid inputs. The program should work the same as before with valid inputs.
Input:
a) assign3-2.py 35 ten
b) assign3-2.py forty 10
Output:
a) Error, please enter numeric input.
b) Error, please enter numeric input.
3. Rewrite the previous program using try and except so that your program handles non-numeric and out of range numbers by printing different messages. The following shows two examples. The program should work the same as before with valid inputs.
Input:
a) assign3-4.py cat
b) assign3-4.py 12
Output:
a) Error, please enter a numeric value.
b) Error, please enter a numeric between 0 and 1.
1. Filename: assign3-1.py Write a program that computes your gross pay. Your code should get two numbers: hours and rate per hour. You should give the employee 1.75 times tfe hourly rate for hours worked above 40 hours. Input: python C:\Users ede\Data Programming MS\assign3-1.py 45 10 Output: Your gross pay 15 1487.5 2. Filename: assign 3-2.py Rewrite the previous program using try and except so that your program handles non-numeric inputs gracefully by printing a message and exciting the program. The following shows two executions of the program with invalid inputs. The program should work the same as before with valid inputs. Input: a) python C:\Users eda Data Programming M233193-2.py 35 ten b) python C:\Users\Data Programin 31 sign 3-2.py forty 10 Output: a) Error, please enter hunti input. b) Erron, please enter numerio inputStep 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