Get input of 3 marks and show percent with pass and fail - problem 2/chapter 6
MY WAY:
a = int(input("enter the marks of chemistry: "))
b = int(input("enter the marks of physics: "))
c = int(input("enter the marks of biology: "))
if((a+b+c/300)<100):
print("you are fail with ", ((a+b+c)/300)*100, " percent only")
else:
print("you are pass with ", ((a+b+c)/300)*100, " percent")
Code with harry way:
This way don't show the percentage to the user.
But it doesn't include maths.
sub1 = int(input("Enter first subject marks\n"))
sub2 = int(input("Enter second subject marks\n"))
sub3 = int(input("Enter third subject marks\n"))
if(sub1<33 or sub2<33 or sub3<33):
print("You are fail because you have less than 33% in one of the subjects")
elif(sub1+sub2+sub3)/3 < 40:
print("You are fail due to total percentage less than 40")
else:
print("Congatulations! You passed the exam")
PROBLEM 6:
marks = int(input("enter your marks: "))
if(marks > 100):
print("you entered wrong marks")
elif(marks >= 90):
print("your grade is- Ex")
elif(marks >= 80):
print("your grade is- A")
elif(marks >=70):
print("your grade is- B")
elif(marks >=60):
print("your grade is- C")
elif(marks >= 50):
print("your grade is- E")
else:
print("you are fail")
PROBLEM 7:
post = input("write the post: ")
if("devil" in post):
print("\'devil\' is in the post")
else:
print("no")
Post a Comment
Post a Comment