Question: else: continue hidden NIDE EMOVEMENTS det confira integer (input,val): L'avvents input vat to integer return false is exception 2.vel: return; integer or False try: convert
else: continue hidden NIDE EMOVEMENTS det confira integer (input,val): L'avvents input vat to integer return false is exception 2.vel: return; integer or False try: convert int = int(input_val) except Excent on as: print("invalid inter) Deturn false return convertint Consider this excerpt from hw1_lecture.py, lines [28:61] have been hidden to show a minimal example of confirm_integer() and its usage. Line 21 initializes a while loop that is always True, and will require the break command to exit the loop (line 25). The variable low, defined line 22, contains a string of user input into the command line after the prompt). 1. What is the expected data type of the input_val parameter of the function confirm_integer()? 2. How does the value of low and the function confirm_integer() determine when the loop defined on line 21 exits? What are the accepted values that will exit the loop? 3. Is "0" an acceptable value to exit the loop and why? Consider this excerpt from hw1_lecture.py, lines (28:61] have been hidden to show a minimal example of confirm_integer() and its usage. Line 21 initializes a while loop that is always True, and will require the break command to exit the loop (line 25). The variable low, defined line 22, contains a string of user input into the command line after the prompt). 1. What is the expected data type of the input_val parameter of the function confirm_integer()? 2. How does the value of low and the function confirm_integer() determine when the loop defined on line 21 exits? What are the accepted values that will exit the loop? 3. Is "O" an acceptable value to exit the loop and why? import matplottib.pyplot as plt import pandas as pd import randon import string Tron numpy.randon import default_rng import datetime det run(): 'main' function for hwi lecture creates some data then saves it in a solder # User enters low, high, n integer print("Creating randon data.") while(True); low = input("Please enter lowest possible value as integer: ") Low_int = confirm_integer(low) 1f low_int: break else: continue HIDE REMOVE COMMENTS det confirm_integer (input_val): hidden : Converts input val to integer, returns False if exception sparge input_val: return: integer or False try: convert_int = int(input_val) except Exception as e: print("invalid integer"). return false return convertint
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
