def main(): #Hardcode roster: #roster = ["Anna", "Tom", "John", "Sam", "Alex", "Emma", "Jack", "Jane", "Mark", "Chris"] #Dictionary: #grades = {"Anna" : 100, "Tom" : 90, "John" : 97, "Sam" : 95, "Alex" : 82, "Emma" : 93, "Jack" : 89, "Jane" : 100, "Mark": 80, "Chris" : 75} #Create a roster of 10 students: roster = [] names = [ "Anna", "Tom", "John", "Sam", "Alex", "Emma", "Jack", "Jane", "Mark", "Chris" ] for i in range(10): name = str(names[i]) grade = random.randint(60, 100) #grade is random number 60-100 #change variable names? student = Student(name, grade) #inside for loop! roster.append(student) #inside for loop! #Print the list of students: for student in roster: student.print_student_info() #Print the average score of the current roster: print("Average grade: " + str(average_grade(roster))) #outside for loop!
def main(): #create 10 students, print the list of students, and print the average score of the roster roster = [] #roster.append(Student("Anna", 0)) #roster.append(Student("Andrew")) #roster.append(Student("John")) #roster.append(Student("Tom")) #roster.append(Student("Lisa")) #roster.append(Student("Tony")) #roster.append(Student("Matt")) #roster.append(Student("Mark")) #roster.append(Student("Chris")) #roster.append(Student("Isaac")) for count in range(10): name = input() grade = input() new_student = Student(name, grade) roster.append(new_student) #for count in roster: #grade = input() #roster.set_grade(grade) average_grade(roster) for student in roster: student.printStudentInfo(student)
def __main__(): roster=[Student("Kaleb", 95), Student("Annie", 75), Student("Julius", 84), Student("Lenny", 95), Student("Nick", 95), Student("Sonny", 95), Student("Mike", 95), Student("David", 95), Student("Yvanna", 95), Student("Beatrice", 95)] for i in roster: i.print_stud_info() print(average_grade(roster))
def average_grade(roster): sum_grades = 0 for i in range(10): sum_grades = sum_grades + Student.get_grade(roster[i]) class_average = sum_grades / 10 return class_average
def main(args): students = [Student("S1", 89)] students.append(Student("S2", 67)) students.append(Student("S3", 74)) students.append(Student("S4", 93)) students.append(Student("S5", 50)) students.append(Student("S6", 65)) students.append(Student("S7", 77)) students.append(Student("S8", 39)) students.append(Student("S9", 100)) for student in students: student.print_student_info() print(average_grade(students))
class __main__(): roster = [] roster.append(Student("Chris", 90)) roster.append(Student("Kelly", 85)) roster.append(Student("Tom", 70)) roster.append(Student("Daniel", 87)) roster.append(Student("John", 92)) roster.append(Student("Matthew", 50)) roster.append(Student("Joanne", 86)) roster.append(Student("Angela", 75)) roster.append(Student("Josephine", 57)) roster.append(Student("William", 88)) for i in roster: i.print_student_info() print(f"Average Grade: {average_grade(roster)}")
class main(): StudentList = [] StudentList.append(Student("Raymond", 90)) StudentList.append(Student("James", 75)) StudentList.append(Student("Michelle", 47)) StudentList.append(Student("Jack", 86)) StudentList.append(Student("Paul", 79)) StudentList.append(Student("Jackie", 37)) StudentList.append(Student("Marie", 84)) StudentList.append(Student("Doug", 45)) StudentList.append(Student("Dan", 65)) StudentList.append(Student("Chris", 99)) for i in range(len(StudentList)): StudentList[i].printStudentInfo() print(f"Average Class Score: {average_Grade(StudentList)}")
def __main__(): roster = [] roster.append(Student("Will", 100)) roster.append(Student("John", 95)) roster.append(Student("Martin", 84)) roster.append(Student("Matt", 97)) roster.append(Student("Fiona", 77)) roster.append(Student("Carrie", 82)) roster.append(Student("Anthony", 100)) roster.append(Student("Joe", 68)) roster.append(Student("Lisa", 89)) roster.append(Student("Sarah", 92)) for i in roster: i.print_student_info() (average_grade(roster))
def __main__(): roster = [ Student("John", 90), Student("Bob", 70), Student("Amanda", 85), Student("Sara", 100), Student("Amy", 65), Student("Oliver", 79), Student("Barry", 45), Student("Jay", 80), Student("Carey", 65), Student("Jax", 98) ] for i in roster: i.print_student_info() print(average_grade(roster))
def main(): roster = [ Student('Billy', 90), Student('Jimmy', 92), Student('Claude', 94), Student('Dimitri', 88), Student('Dorothea', 76), Student('Petra', 96), Student('Felix', 100), Student('Raphael', 75), Student('Lorenz', 95), Student('Hilda', 79) ] for i in roster: i.print_student_info() print('\nAverage grade: {:.2f}'.format(average_grade(roster))) main()
def main(): #creating a list of 10 students roster = [] for i in range(10): name = "name" + str(i) grade = random.randint(0, 100) stud = Student(name, grade) roster.append(stud) for student in roster: student.print_student_info() print("Average of roster is :" + str(average_grade(roster)))
from mymodules.models import Student from mymodules.math_utils import average_grade roster = [] roster.append(Student("Tim", 88)) roster.append(Student("Jam", 74)) roster.append(Student("Steve", 100)) roster.append(Student("Ray", 85)) roster.append(Student("Charlie", 86)) roster.append(Student("Angela", 70)) roster.append(Student("Lidia", 60)) roster.append(Student("Rose", 90)) roster.append(Student("Navi", 78)) roster.append(Student("Larry", 0)) for student in roster: student.print_student_info() print("The average grade is " + str(average_grade(roster)))
from mymodules.models import Student from mymodules.math_utils import average_grade roster = [ Student("Kevin",100), Student("Kelly",93), Student("Toby",88), Student("Michael",62), Student("Creed",91), Student("Phyllis",71), Student("Stanley",88), Student("Dwight",80), Student("Pam",80), Student("Jim",92) ] for i in roster: i.print_student_info() print(f"The Roster's Average is {str(average_grade(roster))}")
from mymodules.models import Student from mymodules.math_utils import average_grade if __name__ == '__main__': student_list = [ Student("John",98.0), Student("Matt", 100.0), Student("Andy", 96.0), Student("Bob", 91.0), Student("Cathy", 67.0), Student("Johny", 98.0), Student("Matty", 100.0), Student("Andyy", 96.0), Student("Boby", 91.0), Student("Cathyy", 67.0) ] for i in student_list: i.print_student_info() print("Their average is: " + str(average_grade(student_list)))
from mymodules.models import Student from mymodules.math_utils import average_grade if __name__ = "main": roster_of_students = [ Student("Asaib",68), Student("Chimp",93), Student("Sainx",89), Student("Thollusk",88), Student("Bijiaf",94), Student("Mituya",75), Student("Fintio",100), Student("Mookkaug",45), Student("Thoshner",79), Student("Op",86), ] for item in roster_of_students: item.print_student_info() print("The Roster's Average is " + str(average_grade(roster_of_students)))
from mymodules.models import Student from mymodules.math_utils import average_grade if __name__ == '__main__': s0 = Student("John",90) s1 = Student("Tom",80) s2 = Student("Andrew",85) s3 = Student("Matthew",91) s4 = Student("Smith",95) s5 = Student("Jessica",99) s6 = Student("Alex",100) s7 = Student("Michelle",93) s8 = Student("Katherine",89) s9 = Student("Nicky",87) students = [s0,s1,s2,s3,s4,s5,s6,s7,s8,s9] for i in students: i.print_student_info() print("Average: "+str(average_grade(students)))