Question: 2. getValidinput that performs and validates user input. It has no parameters. It prompts the user to enter a float value between 0 and 100,

2. getValidinput that performs and validates user input. It has no parameters. It prompts the user to enter a float value between 0 and 100, boundaries included. As long as the value entered is not valid the prompt for a valid value will be repeated. The valld value entered will be returned by the function as a float value. Call the function in an assignment statement (such as validNumber = getValidinput) and print out the value of the variable validNumber Test the function by entering different values. Enter a negative value, #Enter a value greater than 100, ill. Enter the value o iv. Enter the value 100 V. Enter a value between 0 and 100, (not o, not 100) 3. dice Average Wie a value returning function without parameter that simulates rolling a dice (with six numbers) for 1000 times and then calculates and returns the average of all numbers rolled. Use the randint function of the random module for railing the dice Call the function three times. Is the average always the same? Challenges: Use a parameter for the number of repetitions to make your function more flexible or use a parameter for the highest number of the dice, or try both. Tips Use the randint() function from the Python random. module. random, randint(a, b) Return a random integer N such that a
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
