Question

Write code to ask the user for a lab score and a test score. Call calculate_grade...

Write code to ask the user for a lab score and a test score. Call calculate_grade with the appropriate arguments, use the round() function to round the result to 2 decimal places and print the answer.

I'm doing this in Python.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def calculate_grade(lab_score, test_score):
    grade = (lab_score * 50 + test_score * 50) / 100
    return round(grade, 2)


def main():
    lab_score = float(input("Enter lab score: "))
    test_score = float(input("Enter test score: "))
    print("Grade is {:.2f}".format(calculate_grade(lab_score, test_score)))


main()

Add a comment
Know the answer?
Add Answer to:
Write code to ask the user for a lab score and a test score. Call calculate_grade...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a code using loop and flag function in python jupitior notebook: Ask the user for...

    Write a code using loop and flag function in python jupitior notebook: Ask the user for the number of items they bought. Also ask the price of each item they bought and quantity purchased. Display the total amount they owe. Ask the user for a number n. Calculate 1+2+3+….+n. Ask the user for a number n. Calculate 1*2*3*…*n. Ask the user for number of rows (r) and columns (c). Print * for r rows and c columns. Ask the user...

  • Write a Python program that asks the user to type in their three quiz scores (scores...

    Write a Python program that asks the user to type in their three quiz scores (scores between 0 and 100) and displays two averages. The program should be written so one function gets the user to input a score, another function takes the three scores and returns the average of them. And another function takes the three scores and averages the two highest scores (in other words, drops the lowest). Each of these functions should do the computation and return...

  • using python Do it now 2. Write a code with two functions of squared and square_root....

    using python Do it now 2. Write a code with two functions of squared and square_root. At the beginning your code should ask the user to enter one number. Then it should ask the user what they want to do (enter s to calculate the squared value of the entered number and enter r to perform a square root). Then based on the choice of user (using if) the program should call the proper function. Each function, when executing, should...

  • In C code Directions: Write fully executable code when answering the following: 1. Write a function...

    In C code Directions: Write fully executable code when answering the following: 1. Write a function prototype for a function called GetInput that takes no arguments. The function will ask, get, and then return a double value input from the user. 2. Write the function definition for GetInput 3. Write the function call to GetInput using the variable points that has already been declared

  • c++ QUESTION 9 Write a code that ask the user for the number n of decimal...

    c++ QUESTION 9 Write a code that ask the user for the number n of decimal to average. Then n times the code the user to enter all numbers that you save or accumulate each time. Finaly print to the console the average of the n values the user entered using the format: cout << " The average of the " << n << " number you entered is: " << averagedValue <<endl;

  • Write a program that will ask the user to enter 4 quiz scores. These scores should...

    Write a program that will ask the user to enter 4 quiz scores. These scores should be from 0 to 100. Use a procedure and pass by reference to get these scores. Write a function that will find the lowest score. This score will be sent back through the function call. You still need to pass the scores by value to this function. Write a function that will calculate the average score. This value will be sent back to main...

  • in python please I want to create aprogram that's going to ask the user for test...

    in python please I want to create aprogram that's going to ask the user for test Scones saperated by spaces, then I want to print out the lowest score, the highest score, and the test average for example: Entertest scores! 87 96 98 68 your querge is : 82 your lowest score was 68 your highest was 98

  • This is for programming using Python with the JES software. Please write the code with the...

    This is for programming using Python with the JES software. Please write the code with the proper indentation. Thanks! Problem 1: Write a function that takes 2 arguments (integer or float) and computes the sum, difference, product, and quotient of the arguments. Once you calculate the values you should print out statements telling the user what arguments we used to compute the values and what the result of each calculation (your function should produce 5 lines of output in the...

  • Python code Write a program that will ask the user to input two strings, assign the...

    Python code Write a program that will ask the user to input two strings, assign the strings to variables m and n If the first or second string is less than 10 characters, the program must output a warning message that the string is too short The program must join the strings m and n with the join function The output must be displayed. Please name the program and provide at least one code comment (10)

  • Write a complete C++ program to ask the user to enter 4 integers. The program must...

    Write a complete C++ program to ask the user to enter 4 integers. The program must use a function to find the smallest integer among them and print it on the screen. Typical output screen should be as following: Write a complete C++ program to ask the user to enter 4 integers. The program must use a functionto find the smallest integer among them and print it on the screen. Typical output screen should be as following: Note: the code...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT