Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Program to illustrate the use of nested if statement Average in python Grade >=80 and above A >=70 and <80 B >=60 and <70 C >=50 and <60 D Otherwise

sub1=int(input("Enter marks of the first subject: "))
sub2=int(input("Enter marks of the second subject: "))
sub3=int(input("Enter marks of the third subject: "))
sub4=int(input("Enter marks of the fourth subject: "))
sub5=int(input("Enter marks of the fifth subject: "))
avg=(sub1+sub2+sub3+sub4+sub4)/5
if(avg>=80&avg<90):
    print("Grade: A")
elif(avg>=70&avg<80):
    print("Grade: B")
elif(avg>=60&avg<70):
    print("Grade: c")
elif(avg>=50&avg<60):
  print("grade: D")
else:
    print("Grade: e")
Source by www.sanfoundry.com #
 
PREVIOUS NEXT
Tagged: #Program #illustrate #nested #statement #Average #python #Grade #A #B #C #D #Otherwise
ADD COMMENT
Topic
Name
7+5 =