use python Write function letter2number() that takes as input a letter grade (A, B, C, D, F, possibly with a - or +) and returns the corresponding number grade. The numeric values for A, B, C, D, and F are 4, 3, 2, 1, 0. A + increases the number grade value by 0.3 and a - decreases it by 0.3.
>>> letter2number('A-') 3.7 >>> letter2number('B+') 3.3 >>> letter2number('D') 1.0
def letter2number(s):
if s == 'A':
return 4.0
elif s == 'A-':
return 3.7
elif s == 'B+':
return 3.3
elif s == 'B':
return 3.0
elif s == 'B-':
return 2.7
elif s == 'C+':
return 2.3
elif s == 'C':
return 2.0
elif s == 'C-':
return 1.7
elif s == 'D+':
return 1.3
elif s == 'D':
return 1.0
else:
return 0.0
# Testing the function here. ignore/remove the code below if not required
print(letter2number('A-'))
print(letter2number('B+'))
print(letter2number('D'))

use python Write function letter2number() that takes as input a letter grade (A, B, C, D,...
How do you write a program that translate a letter grade into a number grade. Letter grades are A, B, C, D, and F Possibly followed by + or - . Their number values are 4,3,2,1 and 0. There is no F+ nor for F-. A+ increases the numeric value of 0.3 and A - decreases it by 0.3 however an A= has value 4.0
Matlab
a) Write a MATLAB code that takes the grade letters from the user and provide him/her with the GPA for that semester Enter your grades (letters): AABBC (input) Your GPA is 3.2 output) b) Write a Matlab user defined function to that takes a letter grade and return a numeric grade as shown in the table below. Any other value should give an error message (Invalid Grade). You function name should be Letter2Grade Use the following information to calculate...
b) (2.5 marks) Write a Matlab user defined function that takes the letter grades (i.e. AABBC) as input and returns if the student entitled to the honor list or not. The student is considered in the honor s f he or she satisfies the following three conditions: a. An average GPA of 3.5 and above and b. At least two classes with A mark and e. no class with a mark less than C (i.e. no D or F) The...
Using Python programming, defines a function that accepts a letter grade as a parameter and returns the GPA. If the grade is not one of the standard letter grades (A, B, C, D, F), return -1 to indicate this.
C++ Grades . Write a program that uses enum types to assign letter grades that can be automatically converted to numerical grades. For this assignment, you'll create an enum type with the values F, D, C, B, and A, so the letter grades are associated with ordinal values 0, 1, 2, 3, and 4, respectively (which coincide with the quality points for that grade). Write a method assignCourseGrade(double grade) which takes a real number representing the grade for the class,...
Using Python using import numpy as np
3. Write a Python function that is passed a numeric grade from 0 to 100 and returns a letter grade according to the scheme shown in Table 1
Write a python function that takes a string as input, and returns a dictionary of frequencies of all the characters in the string. For example: freq("dabcabcdbbcd") would return {"d":3, "a":2, "b":4, "c":3}. Then write a driver to demonstrate your function.
PYTHON Programming short Questions: 1. Write a function takes as input name (string) and age (number) and prints: My name is <name> and I am <age> years old(where name and age are the inputs) 2. Write a function that takes as input a and b and returns the result of: ??ab 3. Write a function that takes as input a and b and returns the result of: ??ab if it is valid to divide a and b 4. Write a...
A. Write a Python script so that the user can enter any number of grades. Create a calcavg() function so that it takes the number of grades as a parameter and returns the regular average (not a weighted average). You must loop through the grades for full credit. Add a try/except block so that if a non-numeric value is entered, you get the error message shown below. You cannot use lists. Input: c. python …\IT2430\FirstLastname\assign5-2.py 96.7 95.6 87.0 d. python...
Use Python 3.7 to Write a function called volume_of_box() that takes three parameters (the length, width, and height of the box) and returns the volume of the box. Then, use that function in a program which prompts the user to enter the dimensions of a box and returns the volume. Your program should include input validation to ensure that the values entered are positive and should be able to accept float values. Many thanks for all your time and effort...