Create a dictionary of students to store names and marks obtained in 5 subjects
Answers
Answer:
Use Python 3
def main():
def main():subjects, marks_l = [], []
def main():subjects, marks_l = [], []for i in range(5):
def main():subjects, marks_l = [], []for i in range(5):subject, marks = input(f"subject_{i}: "), float(input(f"marks_{i}: "))
def main():subjects, marks_l = [], []for i in range(5):subject, marks = input(f"subject_{i}: "), float(input(f"marks_{i}: "))print()
def main():subjects, marks_l = [], []for i in range(5):subject, marks = input(f"subject_{i}: "), float(input(f"marks_{i}: "))print()subjects.append(subject)
def main():subjects, marks_l = [], []for i in range(5):subject, marks = input(f"subject_{i}: "), float(input(f"marks_{i}: "))print()subjects.append(subject)marks_l.append(marks)
def main():subjects, marks_l = [], []for i in range(5):subject, marks = input(f"subject_{i}: "), float(input(f"marks_{i}: "))print()subjects.append(subject)marks_l.append(marks)return dict(zip(subjects, marks_l))
def main():subjects, marks_l = [], []for i in range(5):subject, marks = input(f"subject_{i}: "), float(input(f"marks_{i}: "))print()subjects.append(subject)marks_l.append(marks)return dict(zip(subjects, marks_l))print(main())
Create a dictionary of students to store names and marks obtained in 5 subjects
PYTHON CODE
students = dict()
n = int(input("Enter number of students :"))
for i in range(n):
sname = input("Enter names of student :")
marks= []
for j in range(5):
mark = float(input("Enter marks :"))
marks.append(mark)
students[sname] = marks
print("Dictionary of student created :")
print(students)
#SPJ3