Created
November 23, 2020 19:39
-
-
Save sshehrozali/493c223a4dbeb93c3bf6115de2f0f4cb to your computer and use it in GitHub Desktop.
Python program to generate result from subjects with student's info and details
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ask for Student's Name, Father's Name, Batch Year and Roll No. | |
Student_name = input("Enter Your Name: ") | |
Father_name = input("Enter Your Father's Name: ") | |
Batch_No = input("Enter Your Batch Year: ") | |
Roll_No = input(f"Your Roll No: {Batch_No[-2] + Batch_No[-1]}B - ") | |
print("_____________________________") | |
# ENGLISH MARKS # | |
print("\n\tEnglish") | |
# Forever Loop | |
while (True): | |
# Ask for obtained marks | |
eng = eval(input("Marks Obtained (Out of 100): ")) | |
# If correct input, break the loop | |
if eng <= float(100): | |
break | |
# If not correct input, Print Error | |
print("Wrong Marks\n") | |
print("\n") | |
# PHYSICS MARKS # | |
print("\tPhysics") | |
# Forever Loop | |
while (True): | |
# Ask for obtained marks | |
phy = eval(input("Marks Obtained (Out of 100): ")) | |
# If correct input, break the loop | |
if phy <= float(100): | |
break | |
# If not correct input, Print Error | |
print("Wrong Marks\n") | |
print("\n") | |
# MATHEMATICS MARKS # | |
print("\tMathematics") | |
# Forever Loop | |
while (True): | |
# Ask for obtained marks | |
math = eval(input("Marks Obtained (Out of 100): ")) | |
# If correct input, break the loop | |
if math <= float(100): | |
break | |
# If not correct input, Print Error | |
print("Wrong Marks\n") | |
print("\n") | |
# CHEMISTRY MARKS # | |
print("\tChemistry") | |
# Forever Loop | |
while (True): | |
# Ask for obtained marks | |
chem = eval(input("Marks Obtained (Out of 100): ")) | |
# If correct input, break the loop | |
if chem <= float(100): | |
break | |
# If not correct input, Print Error | |
print("Wrong Marks\n") | |
print("\n") | |
# COMPUTER SCIENCE MARKS # | |
print("\tComputer Science") | |
# Forever Loop | |
while (True): | |
# Ask for obtained marks | |
comp = eval(input("Marks Obtained (Out of 100): ")) | |
# If correct input, break the loop | |
if comp <= float(100): | |
break | |
# If not correct input, Print Error | |
print("Wrong Marks\n") | |
# Calculate Total Marks Obtained | |
total = eng + phy + math + chem + comp | |
# Calculate Percentage | |
percentage = (total / 500) * 100 | |
# String to store grade | |
grade = "" | |
# Check for grades | |
if percentage >= 90: | |
grade += "A+" | |
if percentage < 90 and percentage >= 80: | |
grade += "A" | |
if percentage < 80 and percentage >= 70: | |
grade += "B" | |
if percentage < 70 and percentage >= 60: | |
grade += "C" | |
if percentage < 60 and percentage >= 50: | |
grade += "D" | |
if percentage < 50: | |
grade = "F" | |
# RESULT FOR STUDENT # | |
# Print Student info | |
print("\n__________________________________________") | |
print(f"\tRESULT FOR {Student_name.upper()}") | |
print("Father's Name: ", Father_name.upper(), f"\nBatch Year: 20{Batch_No[-2] + Batch_No[-1]}" ,f"\nRoll No: {Batch_No[-2] + Batch_No[-1]}B -", Roll_No) | |
print("\n") | |
# Print Subject Marks | |
print("\tMARKS DETAILS") | |
print(f"English: 100/{eng}") | |
print(f"Physics: 100/{phy}") | |
print(f"Mathematics: 100/{math}") | |
print(f"Chemistry: 100/{chem}") | |
print(f"Computer Science: 100/{comp}\n") | |
print("\n") | |
# Print Total Obtained, Percentage and Grade | |
print(f"TOTAL MARKS: 500/{total}") | |
print(f"PERCENTAGE: {percentage}") | |
print(f"GRADE: {grade}") | |
print("\n") | |
print("__________________________________________\n") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment