Computer Science, asked by GTVIDHAAN, 3 months ago

To print the report cards of 30 students of your class.

don't spam​

Answers

Answered by jai696
2

\huge\red{\mid{\fbox{\tt{Using\: Python\: 3}}\mid}}

from random import randrange, sample

from string import ascii_lowercase

def gen_reports():

reports = {}

subjects = ["English", "Maths", "Science", "Economics", "History"]

for x in range(30):

marks = [randrange(10, 99) for n in range(5)]

reports[f"student_{x}"] = {

"name": "".join(sample(ascii_lowercase, 5)),

"marks": list(zip(subjects, marks))

}

return reports

reports = gen_reports()

for k in reports.keys():

student = reports[k]

print("Name:", student["name"])

for subject in student["marks"]:

print(f"{subject[0]}:", subject[1])

print()

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Similar questions