Question
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
media%2F7bd%2F7bd67e64-5acc-4576-8d1e-aa
0 0
Add a comment Improve this question Transcribed image text
Answer #1

grade2.py - D:/Coding/PYTHON/grade2py (3.6.2) File Edit Format Run Options Window Help def letter grade (grade) if grade<o or grade>100: print (Invalid grade) return if grade>=90 and grade<=100: elif grade>-80 and grade<90: elif grade>=70 and grade<80: elif grade> 60 and grade<70: else: retur A return B retur C return D returE

OUTPUT :

CODE :

def letter_grade(grade):
if grade<0 or grade>100:
print('Invalid grade')
return
if grade>=90 and grade<=100:
return 'A'
elif grade>=80 and grade<90:
return 'B'
elif grade>=70 and grade<80:
return 'C'
elif grade>=60 and grade<70:
return 'D'
else:
return 'E'

Add a comment
Know the answer?
Add Answer to:
Using Python using import numpy as np 3. Write a Python function that is passed a...
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
  • Problem 2 using Python NumPy and Pandas libraries NOTES: Import NumPy as np and Pandas as...

    Problem 2 using Python NumPy and Pandas libraries NOTES: Import NumPy as np and Pandas as pd Given the following piece of code to create a NumPy array, anIntArray: anIntArray = np.random.randint(5, 72, 48) Add Python code to convert this array into a Pandas series and then extract values stored at the positions 0, 5, 10, 15, 20 of the series.

  • IN PYTHON 3 GIVING THIS CODE %matplotlib inline import numpy as np import matplotlib.pyplot as plt...

    IN PYTHON 3 GIVING THIS CODE %matplotlib inline import numpy as np import matplotlib.pyplot as plt from sklearn import datasets N_samples = 2000 X = np.array(datasets.make_circles(n_samples=N_samples, noise=0.05, factor=0.3)[0]) plt.scatter(X[:,0], X[:,1], alpha=0.8, s=64, edgecolors='white'); Use Spectral Clustering to cluster the points and visualize your result

  • Python import numpy as np import matplotlib.pyplot as plt Implement three different methods to si...

    Python import numpy as np import matplotlib.pyplot as plt Implement three different methods to simulate a Poisson process (No λ 0.1 on the time interval [0, 1001 with parameter For each method, plot a trajectory of your simulated process. 1. Method 1:use the exponentially distributed interarrial times Python import numpy as np import matplotlib.pyplot as plt Implement three different methods to simulate a Poisson process (No λ 0.1 on the time interval [0, 1001 with parameter For each method, plot...

  • In Python import numpy as np Given the array a = np.array([[1, 2, 3], [10, 20,...

    In Python import numpy as np Given the array a = np.array([[1, 2, 3], [10, 20, 30], [100, 200, 300]]), compute and print the sums over all rows (should give [6, 60, 600]) the sums over all columns (the sum of he first column is 111) the maximum of the array the maxima over all rows the mean of the sub-array formed by omitting the first row and column the products over the first two columns (hint: look for an...

  • python Problem 3-6 points First, start with the following code: import numpy as np A np.random....

    python Problem 3-6 points First, start with the following code: import numpy as np A np.random. randint (0, 10, sie n,n)) np. savetxt ('exam2.txt', A, fmt-idelimiter B-# np. zeros ( (n, n) , dtypes, int 64, ) When run, it will produce a file named "exam2.txt" that has 5 rows each with 5 numbers separated by commas,. In addition, a 5 by 5 array of zeros named B is defined. Run this code, but do not change it Your job...

  • Python...I don't know what is wrong with my code: import numpy as np from mpi4py import...

    Python...I don't know what is wrong with my code: import numpy as np from mpi4py import MPI array= [14,175, 15,055, 16,616, 17,495, 18,072, 19,390] array1,array2= array[ : :2], array[1: :2] print (array1) print (array2) /////it should print array1 = [1,4175, 16,616,18,072] array2= [15,055, 17,495, 19,390]

  • In 17]:import numpy as np import matplotlib.pyplot as plt Implement three different methods to si...

    In 17]:import numpy as np import matplotlib.pyplot as plt Implement three different methods to simulate a Poisson process (Nog 100 with parameter λ = 0.1 on the time interval [0, 100]. For each method, plot a trajectory of your simulated process 1. Method 1: In 17]:import numpy as np import matplotlib.pyplot as plt Implement three different methods to simulate a Poisson process (Nog 100 with parameter λ = 0.1 on the time interval [0, 100]. For each method, plot a...

  • python import numpy as np s = 46916 np.random.seed(s) Z = np.random.randint(42,512,(48,12)) The random values in...

    python import numpy as np s = 46916 np.random.seed(s) Z = np.random.randint(42,512,(48,12)) The random values in Z are supposed to be uniformly distributed from 42 to 512. This means there should be about the same number of items in the range 100-199 as there is 200-299. What is the absolute difference between the number of items in these ranges, inclusive of the upper and lower bound? hint: np.histogram accepts bin limits as a list

  • import numpy as np from scipy.special import comb def cumulative_comb_with_repetition(n, k): """ Compute the number of...

    import numpy as np from scipy.special import comb def cumulative_comb_with_repetition(n, k): """ Compute the number of possible non-negative, integer solutions to x1 + x2 + ... + xk <= n.    We will use this function to compute the dimension of order k polynomial feature vector Args: n: integer, the number of "balls" or "stars" k: integer, the number of "urns" or "bars"    Returns: the total number of combinations, integer. """ # your code below # your code above...

  • use python Write function letter2number() that takes as input a letter grade (A, B, C, D,...

    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

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