Question: TASK 2 : Dimensional information and data validation ( 1 3 1 7 min ) Write a user - defined function named vector. which validates

TASK 2: Dimensional information and data validation (1317 min) Write a user-defined function named vector. which validates a users input. This function should use the same syntax as the built-in input() function with one input (the prompt) and one output (the stored variable). In the function, perform the following data validation: if the entered value is zero or negative, prompt the user for a new value. If after 3 attempts the user has not entered a positive value, produce a warning and take the absolute value of the most recently entered value. If the most recent value is zero, produce an error and terminate the program. Call this function 3 times in your main script to prompt the user for the length L [m], the width w [m], and the height h [m] of the beam.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!