[Python] Create a dictionary that contains student name, roll no and marks obtained

Discussão em 'Python' iniciado por Stack, Maio 1, 2025.

  1. Stack

    Stack Membro Participativo

    I did a program to create a dictionary that contains student name, roll no and marks obtained.When I execute it to form multiple dictionaries instead of one. This is the code:

    def student(x,y,z):
    result = {}
    result[roll_no] = [std_name, marks]
    print(result)


    n = int(input("Enter No of Students:"))
    for i in range(n):

    roll_no = int(input("Roll No: "))
    std_name = input("Student Name: ")
    marks = int(input("Marks: "))
    student(std_name, roll_no, marks)

    Continue reading...

Compartilhe esta Página