English

Write a function to push any student's information to stack.

Advertisements
Advertisements

Question

Write a function to push any student's information to stack.

Code Writing
Advertisements

Solution

student_stack = []


def push_student(name, roll_number, marks):
    student = {
        "name": name,
        "roll_number": roll_number,
        "marks": marks,
    }
    student_stack.append(student)  # Push student information
    print("Student information inserted")


push_student("Riya", 101, 92)
shaalaa.com
  Is there an error in this question or solution?
Chapter 6: Stacks & Queues in list - EXERCISE [Page 123]

APPEARS IN

CBSE Computer Science with Python [English] Class 12
Chapter 6 Stacks & Queues in list
EXERCISE | Q 24. | Page 123
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×