Robotics & Artificial Intelligence

Write a program in Python to create a list of your classmates containing their names and roll numbers. Access the roll number of the student whose name is stored at 2nd index.

Python List Manipulation

2 Likes

Answer

classmates = [
    ["Amit", 1],
    ["Neha", 2],
    ["Rohit", 3],
    ["Sneha", 4]
]
print("Roll number:", classmates[2][1])

Output

Roll number: 3

Answered By

2 Likes


Related Questions