Welcome to Python World!

Learn Coding Step by Step 🚀

A fun beginner programming course for young programmers
Created by Geta Ba / GETCOM

🎯 What Will You Learn Today?

✅ Example 11: Pass or Fail Using if...else

Python can decide whether a student passes or fails.

🐍 Python Code



# EXAMPLE 11: PASS OR FAIL USING IF...ELSE

marks = float(input("Enter Student Marks: "))

if marks >= 50:
    print("Result : PASS")
else:
    print("Result : FAIL")

🤖 Python Output

Enter Student Marks: 67


Result : PASS ✅

⭐ Challenge: Try entering 49 and 50. What happens?

🏆 Example 12: Student Grade

Python determines a student's grade automatically.

🐍 Python Code



marks = float(input("Enter Student Marks (0-100): "))

if marks >= 90:
    grade = "A+"
elif marks >= 80:
    grade = "A"
elif marks >= 70:
    grade = "B"
elif marks >= 60:
    grade = "C"
elif marks >= 50:
    grade = "D"
else:
    grade = "F"

print("\n------ STUDENT RESULT ------")
print("Marks =", marks)
print("Grade =", grade)

🤖 Python Output

Enter Student Marks (0-100): 86


Marks = 86

Grade = A ⭐

🎯 Challenge: Try entering 95, 72, 45 and compare the grades.

🔢 Example 13: Even and Odd Numbers

Python checks whether a number is even or odd.

🐍 Python Code



number = int(input("Enter a Number: "))

if number % 2 == 0:
    print("Number =", number, "is Even Number")
else:
    print("Number =", number, "is Odd Number")

🤖 Python Output

Enter a Number: 17


Number = 17 is Odd Number

⭐ Challenge: Test 8, 11, 24 and 51.

📊 Example 14: Student Grade Using AND Operator

Python calculates the average and assigns a grade.

🐍 Python Code



maths = float(input("Enter Maths Mark: "))
english = float(input("Enter English Mark: "))
biology = float(input("Enter Biology Mark: "))

total = maths + english + biology
mark = total / 3

if mark > 100:
    grade = "Not Allowed"

elif mark >= 90 and mark <= 100:
    grade = "A"

elif mark >= 70 and mark < 90:
    grade = "B"

elif mark >= 50 and mark < 70:
    grade = "C"

elif mark >= 0 and mark < 50:
    grade = "F"

else:
    grade = "Invalid Mark"

print("Student Total =", total)
print("Average =", mark)
print("Grade =", grade)

🤖 Python Output

Maths = 85

English = 90

Biology = 80


Total = 255

Average = 85

Grade = B

🚀 Project: Add more subjects and calculate the final grade.

🔤 Example 15: Identify Vowel or Consonant

Python identifies whether a letter is a vowel or a consonant.

🐍 Python Code



letter = input("Enter a letter: ")

letter = letter.lower()

if letter == "a" or letter == "e" or letter == "i" or letter == "o" or letter == "u":
    print("Letter =", letter, "is Vowel")
else:
    print("Letter =", letter, "is Consonant")

🤖 Python Output

Enter a letter: A


Letter = a is Vowel

⭐ Challenge: Try **A**, **E**, **K**, **M**, and **U**.