Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. calculateLetterGrade will return the string of the letter grade given at Coquitlam College for a given percent mark (See table at the top of

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
1. calculateLetterGrade will return the string of the letter grade given at Coquitlam College for a given percent mark (See table at the top of our course webpage) The function has one float parameter that represents the percent mark. (no print statement in the function!) Call the function in a loop, where the user will enter a percent mark (-1 will stop the loop) and the program will display the lettergrade by calling the function in the print() statement like this: print("Your lettergrade is calculateLetterGrade(...)) 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 valid value entered will be returned by the function as a float value Call the function in an assignment statement (such as valid Number = getValidinput()) and print out the value of the variable validNumber Test the function by entering different values Enter a negative value i Enter a value greater than 100 illEnter the value o v Enter the value 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 valid 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 1. Enter a negative value, i Enter a value greater than 100 ill. Enter the value 0. iv. Enter the value 100 V. Enter a value between 0 and 100, (not 0, not 100) 3. diceAverage Write 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 rolling 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

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

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

Th ey have to wait a long time for an appointment?

Answered: 1 week ago

Question

1. Prepare a flowchart of Dr. Mahalees service encounters.

Answered: 1 week ago