In this python if else program, we will check whether a student has passed the exam or not depending on the marks scored by the student.
Condition to pass the test:
If the marks obtained by the student are equal to or greater than 45 then the student has passed the test, otherwise student has failed the test.
Steps to solve the program
- Take the marks of the student as input through the user.
- Use an if-else statement to determine whether a student has passed the exam or not.
- Use the criteria given in the question to determine the outcome.
- Print the output.
marks = int(input("Enter marks of a student: "))
if marks>=45:
print("Pass")
else:
print("Fail")
Output :
Enter marks of a student: 50
Pass
Related Articles
Python program to check whether the given number is positive or not.
Python program to check whether the given number is negative or not.
Python program to check whether the given number is positive or negative and even or odd.
Python program to print the largest number from two numbers.
Python program to check whether a given character is uppercase or not.
Python program to check whether the given character is lowercase or not.