A ( 8. Write a function which is given an exam mark, and it returns a string - the grade for that mark according to this scheme: | Mark Grade >= 75 First [70-75) Upper Second [60-70) Second [50-60) Third [45-50) F1 Supp [40-45) F2 < 40 F3 The square and round brackets denote closed and open intervals. A closed interval includes the number, and open interval excludes it. So 39.99999 gets grade F3, but 40 gets grade F2. Assume project.net/thinkcs/python/english3e/conditionals.html[1/4/2012 9:37:12 PM] - How to Think Like a Computer Scientist: Learning with Python 3 [83, 75, 74.9, 70, 69.9, 65, 60, 59.9, 55, 50, 49.9, 45, 44.9, 40, 39.9, 2, 0 XS = Test your function by printing the mark and the grade for all the elements in this list.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter9: Completing The Basics
Section9.4: Character Manipulation Functions
Problem 5E
icon
Related questions
Question
How do you do this?
4. not (3 < 4)
* (8. Write a function which is given an exam mark, and it returns a string -the grade for that mark
- according to this scheme:
Mark
Grade
>= 75
First
[70-75) Upper Second
[60-70) Second
[50-60) Third
[45-50) F1 Supp
[40-45) F2
< 40
F3
The square and round brackets denote closed and open intervals. A closed interval includes the
number, and open interval excludes it. So 39.99999 gets grade F3, but 40 gets grade F2.
Assume
sproject.net/thinkcs/python/english3e/conditionals.html[1/4/2012 9:37:12 PM]
- How to Think Like a Computer Scientist: Learning with Python 3
XS = [83, 75, 74.9, 70, 69.9, 65, 60, 59.9, 55, 50,
49.9, 45, 44.9, 40, 39.9, 2, 0
Test your function by printing the mark and the grade for all the elements in this list.
Transcribed Image Text:4. not (3 < 4) * (8. Write a function which is given an exam mark, and it returns a string -the grade for that mark - according to this scheme: Mark Grade >= 75 First [70-75) Upper Second [60-70) Second [50-60) Third [45-50) F1 Supp [40-45) F2 < 40 F3 The square and round brackets denote closed and open intervals. A closed interval includes the number, and open interval excludes it. So 39.99999 gets grade F3, but 40 gets grade F2. Assume sproject.net/thinkcs/python/english3e/conditionals.html[1/4/2012 9:37:12 PM] - How to Think Like a Computer Scientist: Learning with Python 3 XS = [83, 75, 74.9, 70, 69.9, 65, 60, 59.9, 55, 50, 49.9, 45, 44.9, 40, 39.9, 2, 0 Test your function by printing the mark and the grade for all the elements in this list.
1.
pass
lif
main_':
name
main()
def grade(marks):
if marks >= 75:
return("Grade: First")
elif marks >-70 and marks <75:
200
return("Grade: Upper Second")
elif marks >-60 and marks <70:
return("Grade: second")
elif marks >-50 and marks <60:
returi(" Grade: Third")
elif marks >-45 and marks <50:
print("Grade: F1 Supp")
elif marks>-40 and marks <45:
print("Grade: 52")
else:
print ("Grade: F3")
300
Co...er
Omodule1 module2
22
Reinitiel ee
Transcribed Image Text:1. pass lif main_': name main() def grade(marks): if marks >= 75: return("Grade: First") elif marks >-70 and marks <75: 200 return("Grade: Upper Second") elif marks >-60 and marks <70: return("Grade: second") elif marks >-50 and marks <60: returi(" Grade: Third") elif marks >-45 and marks <50: print("Grade: F1 Supp") elif marks>-40 and marks <45: print("Grade: 52") else: print ("Grade: F3") 300 Co...er Omodule1 module2 22 Reinitiel ee
Expert Solution
Explanation

1) Below is program to define the function which returns grade for a mark. Test with list of marks

  • It define function to return grade for a mark
    • check the mark and return the grade
  • In main of program
    • It define list of marks
    • Iterate through list of marks
      • Display Marks and Grade return from grade function

2) Save program in python file and run

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning