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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education