Skip to content

Instantly share code, notes, and snippets.

@Raj39120
Created May 2, 2020 22:58
Show Gist options
  • Save Raj39120/41888b28fbcd8b61aa2d6219b55bc8b4 to your computer and use it in GitHub Desktop.
Save Raj39120/41888b28fbcd8b61aa2d6219b55bc8b4 to your computer and use it in GitHub Desktop.
class Student:
name = 0
age = 0
role_number = 0
math_marks = 0
english_marks = 0
science_marks = 0
def __init__(self):
pass
def user_input(self):
self.name = (raw_input("Enter your name over here: "))
self.age = input("Enter your age over here: ")
self.role_number = input("Enter your role number over here: ")
self.math_marks = input("Enter your math marks out of 100 over here: ")
while self.math_marks > 100:
print("Enter a valid number for you math marks.")
self.math_marks = input("Enter your math marks out of 100 over here: ")
self.english_marks = input("Enter your english marks out of 100 over here: ")
while self.english_marks > 100:
print("Enter a valid number for your english marks.")
self.english_marks = input("Enter your english marks out of 100 over here: ")
self.science_marks = input("Enter your science marks out of 100 over here: ")
while self.science_marks > 100:
print("Enter a valid number for your science.")
self.science_marks = input("Enter your science marks out of 100 over here: ")
def output(self):
print(self.name)
print(self.age)
print(self.role_number)
if self.math_marks >= 90:
print(str(self.math_marks) + "% " + "A")
if 89 >= self.math_marks >= 80:
print(str(self.math_marks) + "% " + "B")
if 79 >= self.math_marks >= 70:
print(str(self.math_marks) + "% " + "C")
if 69 >= self.math_marks >= 60:
print(str(self.math_marks) + "% " + "D")
if 59 >= self.math_marks >= 0:
print(str(self.math_marks) + "% " + "F")
if self.english_marks >= 90:
print(str(self.english_marks) + "% " + "A")
if 89 >= self.english_marks >= 80:
print(str(self.english_marks) + "% " + "B")
if 79 >= self.english_marks >= 70:
print(str(self.english_marks) + "% " + "C")
if 69 >= self.english_marks >= 60:
print(str(self.english_marks) + "% " + "D")
if 59 >= self.english_marks >= 0:
print(str(self.english_marks) + "% " + "F")
if self.science_marks >= 90:
print(str(self.science_marks) + "% " + "A")
if 89 >= self.science_marks >= 80:
print(str(self.science_marks) + "% " + "B")
if 79 >= self.science_marks >= 70:
print(str(self.science_marks) + "% " + "C")
if 69 >= self.science_marks >= 60:
print(str(self.science_marks) + "% " + "D")
if 59 >= self.science_marks >= 0:
print(str(self.science_marks) + "% " + "F")
Student_Info = Student()
Student_Info.user_input()
Student_Info.output()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment