Question

#write a function with int parameter to return letter grade for integer score # complete the...

#write a function with int parameter to return letter grade for integer score

# complete the code below:

def grader(int1):
grade = ''
if int1 >=90:
grade = 'A'
elif int1 >=80:
grade = 'B'
elif int1 >=70:

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#write a function with int parameter to return letter grade for integer score
# complete the code below:
def grader(int1):
    grade = ''
    if int1 >=90:
        grade = 'A'
    elif int1 >=80:
        grade = 'B'
    elif int1 >=70:
        grade = 'C'
    elif int1 >=60:
        grade = 'D'
    else:
        grade = 'E'
    return grade

# Testing
n = float(input("Enter score: "))
print(grader(n))

Add a comment
Know the answer?
Add Answer to:
#write a function with int parameter to return letter grade for integer score # complete the...
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
  • 1. Create a program that takes a numerical score and outputs a letter grade. 2. In...

    1. Create a program that takes a numerical score and outputs a letter grade. 2. In this program, create two void functions titled makeScore and theGrade with an int argument. 3. The function makeScore should have a Reference parameter and theGrade should have a Value parameter. Note: Specific numerical scores and letter grades are listed below: 90-100 = Grade A 80-89 = Grade B 70-79 = Grade C 60-69 = Grade D 0-59 = Grade F 4. The function makeScore...

  • def computeGrade(percentage):     '''     - Return the corresponding letter grade string based on the value...

    def computeGrade(percentage):     '''     - Return the corresponding letter grade string based on the value of     percentage using the following scale:     [100 - 90]: 'A'     (90 - 80] : 'B'     (80 - 70] : 'C'     (70 - 60] : 'D'     (60 - 0] : 'F'     - If percentage is not a number type (int or float) OR if percentage is     outside the range of [100 - 0], return an empty string...

  • Below is a java program that inputs an integer grade and turns it into a letter...

    Below is a java program that inputs an integer grade and turns it into a letter grade. Update the below java code as follows and comment each line to explain what is happening: 1. Convert the if-else-if code block to a switch statement to solve the problem. 2. Use modulus to convert the grade input so that the range of grades are converted to one value. (comment the line) import java.util.Scanner; public class GradeLetterTest { public static void main(String[] args)...

  • Design a function named max that accepts two integer values as arguments and returns the value...

    Design a function named max that accepts two integer values as arguments and returns the value that is the greater of the two. For example, if 7 and 12 are passed as arguments to the function, the function should return 12. Use the function in a program that prompts the user to enter two integer values. The program should display the value that is the greater of the two. Need Variable lists, Psuedocode, ipo chart, Flow Chart, and a python...

  • Write a method that takes an ArrayList of Integer objects and returns an ArrayList of Character...

    Write a method that takes an ArrayList of Integer objects and returns an ArrayList of Character objects of the same size. The returned elements of the ArrayList are assigned letter grade corresponding to integer grade of the same index element of the ArrayList parameter (A if 90 or above, F if less than 60). Include code to test your method. [For other letter grades: 80 ?? 89 −> ?, 70 ?? 79 −> ?, 60 ?? 69 −> ?]

  • HINT 1)-Write a method to accept n integer number between 0 and 100 and return the...

    HINT 1)-Write a method to accept n integer number between 0 and 100 and return the average. 2)-Write a method to convert an the letter grade as follow. integer number between 0 and 100 to latter grade A to F and return. 100-90->A 89-80->B 79-70->C 69-60->D 00-59->F 3)-Write a method to compute GPA for following letter grade and return the GPA value. A =>4.0 B ->3.0 C->20 D->1.0 Hint for option 1 1 import java.util.Scanner 2 public class ProjPart2 3...

  • MATLAB Code: ?MATLAB Code: Write a function that converts a given letter grade it will print...

    MATLAB Code: ?MATLAB Code: Write a function that converts a given letter grade it will print its equivalence in numerical scale. For example if the user enters A, then your function should print a message stating that the grade must be between 90 and 100. B is between 80 and 89, etc. Everything under 60 is F. Use the switch-case function. Use fprintf to display the results on the screen.

  • 4. Write a C function int str2int(char *s) that takes string s as parameter and return...

    4. Write a C function int str2int(char *s) that takes string s as parameter and return the integer that s represents. For example, if string s is 123", then the function return integer 123.

  • Write a C++ program that will provide a user with a grade range if they enter...

    Write a C++ program that will provide a user with a grade range if they enter a letter grade. Your program should contain one function. Your function will accept one argument of type char and will not return anything (the return type will be void), but rather print statements to the console. Your main function will contain code to prompt the user to enter a letter grade. It will pass the letter grade entered by the user to your function....

  • Write a program that asks the user to enter five test scores. The program should display...

    Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Design the following functions in the program: calcAverage—This function should accept five test scores as arguments and return the average of the scores. determineGrade—This function should accept a test score as an argument and return a letter grade for the score (as a String), based on the following grading scale: Score Letter Grade...

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