Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Grading program using if else

print("Grade List")
print ("==========")
def gradeAssign(marks):
    assert marks>=0 and marks<=100
    
    if marks>=90:
        grade="A"
    elif marks>=70:
        grade="B"
    elif marks>=50:
        grade="C"
    elif marks>=40:
        grade="D"
    else:
        grade="F"
    
    return grade
    
def main():
    marks = float(input('Enter your marks: '))
    print("Marks: ", marks, "
Grade: ", gradeAssign(marks))
    
main()
Comment

PREVIOUS NEXT
Code Example
Python :: matplotlib pie turn small pct labels off 
Python :: foreach on sysargv 
Python :: how to return and use a single object in custom template filters django 
Python :: python faq call by reference 
Python :: faceModel = "opencv_face_detector_uint8.pb" 
Python :: write console output in same place 
Python :: Add 1 to loops 
Python :: codeforces 1133A in python 
Python :: mavproxy arm 
Python :: vortex identification 
Python :: to iterate across information on same nest 
Python :: ouvrir fichier txt python et le lire 
Python :: how to write together string type value and int type value in print function in python 
Python :: Broadcasting with NumPy Arrays Single dimension array Example 
Python :: Python NumPy copyto function example copy elements from a source array to a destination array. 
Python :: how to make dinamic table in jinja python 
Python :: Python NumPy asfarray Function Syntax 
Python :: Python NumPy column_stack Function Example with 1d array 
Python :: How can I Duplicate 1 Dimensional array 
Python :: python pandas read parquet with progressbar 
Python :: python cos not the same as calculator 
Python :: python fft 
Python :: lambda function in python to shut ec2 at the time zone 
Python :: # remove sensitive information like name, email, phone no from text 
Python :: get primary key in get_context_data 
Python :: how to process numerical data machine learning 
Python :: parsing output from ping - python 
Python :: map function in pyhton 
Python :: python 3.9.7 
Python :: session timeout flask 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =