Commit 3b50aa06 by likorn

Upload New File

parent 1bd58b1a
Showing with 25 additions and 0 deletions
import random
name = input("Enter your name: ")
age = input("Enter your age: ")
courses = []
student = {'name': name, 'age': age, 'courses': courses}
while True:
grades = []
course = {'course_name': "", 'grades': grades, 'average': 0}
print("Enter your courses' names, the grades will be generated automatically. Press 0 when you finish")
inp = input()
if inp == '0':
break
else:
course['course_name'] = inp
for x in range(0, 10):
grades.append(random.randrange(1, 5))
course['average'] = str(int(course['average']) + grades[grades.__len__()-1])
course['grades'] = grades
course['average'] = str(int(course['average'])/10)
student['courses'].append(course)
for x in range(0, student['courses'].__len__()):
print("You got the average grade "+student['courses'][x]['average']+" in "+student['courses'][x]['course_name'])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment