示例#1
0
def main():

    student1 = Student('Ashley', 12)

    is_running = True
    while is_running == True:
        menu = input(
            "Enter 'A' to add score. Enter 'B' to get current score. Enter 'C' to get letter grade. Enter 'D' to quit: "
        )
        print(menu)
        if menu == 'A':
            prompt1 = int(input("Enter new score: "))
            print(prompt1)
            student1.add_score(prompt1)

        elif menu == 'B':
            print("Student Score: {}.".format(student1.get_scores()))

        elif menu == 'C':
            print("Student Grade: {}.".format(student1.get_grade()))

        elif menu == 'D':
            is_running = False
            print("Goodbye.")
            break
示例#2
0
def main():

	a = Student("Elle")
	b = Student("Brian")

	# No scores added yet
	a.avg_score()

	a.add_score(80)
	a.add_score(95)
	a.add_score(85)

	a.avg_score()

	b.add_score(85)
	b.add_score(100)
	b.add_score(85)

	b.avg_score()
示例#3
0
sc = School()

while(True):
    cmd = input("which do you want??\n** Press [ctrl+c] to quit\nadd_Student(ast)\tprint_All(p)\tadd_Score(asc)\tcheck_fail(cf)\nidiot(li)\tgenius(lg)")
    if cmd == "ast":
        name = input("name: ")
        sex = input("sex [M/F]: ")
        idnumber = input("idnumber: ")
        s = Student(name, sex, idnumber)
        while(True):
            score = int(input("Score: (-0 to quit)"))
            if score == -0:
                break
            else:
                s.add_score(score)
        sc.add_student(s)
    elif cmd == "p":
        sc.print()
    elif cmd == "asc":
        name = input("name: ")
        score = int(input("score: "))
        s = sc.get_student(name)
        s.add_score(score)
    elif cmd == "cf":
        sc.list_fail()
    elif cmd == "lg":
        sc.list_genious()
    elif cmd == "li":
        sc.list_idiot()
示例#4
0
from student import Student
from school import School

sc = School()

s = Student("pinsi", "F")
s.add_score(100)
sc.add_student(s)

s = Student("prmge", "M")
s.add_score(98)
sc.add_student(s)

sc.print()

while (True):
    cmd = int(input("1 = add student\ 2 = print all\ 3 = add score "))
    if cmd == 1:
        name = input("name:")
        sex = input("sex:")
        s = Student(name, sex)
        sc.add_student(s)
    elif cmd == 2:
        sc.print()
    elif cmd == 3:
        name = input("name:")
        score = int(input("score:"))
        s = sc.get_student(name)
        s.add_score(score)