#๐Ÿ”’ How to do this condition 3

6 messages ยท Page 1 of 1 (latest)

urban steppe
#

I don't know how it works
this is currently my code

name = str(input("What is your name? "))
math_grade = int(input("What is your math grade? "))
science_grade = int(input("What is your science grade? "))
english_grade = int(input("What is your english grade? "))
average = int(math_grade + science_grade + english_grade) / int(3)
print (f'Average Score {average}')

if average >= 75: #75,0
print (f'CONGRATULATIONS! You passed this semester')
elif math_grade < 75: #0,75
print (f'But you need to re-enroll Math Subject')
elif science_grade < 75: # 0,75
print(f'But you need to re-enroll Science Subject')
elif english_grade < 75: # 0,75
print(f'But you need to re-enroll English Subject')

elif average > 0: #0,74
print(f'Sorry, you FAILED this semester')

storm lodgeBOT
#

@urban steppe

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

tribal nova
#

elif only runs if the previous if/elif conditions before it were not true. If you want all checks to happen regardless of what prior checks were true, you don't want elif.

#

@urban steppe

storm lodgeBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.