Question:medium

A tuple named subject stores the names of different subjects. Write the Python commands to convert the given tuple to a list and thereafter delete the last element of the list.

Show Hint

Use list()} to convert a tuple to a list, and pop()} to remove the last element of a list.
Updated On: Jan 13, 2026
Show Solution

Solution and Explanation

# Given tuple
subject = ("Mathematics", "Physics", "Chemistry", "Biology")

# Step 1: Convert the tuple to a list
subject_list = list(subject)

# Step 2: Delete the last element of the list
subject_list.pop()

# Resulting list
print(subject_list)  # Output: ['Mathematics', 'Physics', 'Chemistry']
    
Explanation: A tuple named subject is provided, containing subject names. The list() function converts the tuple to a list: subject_list = list(subject). The pop() method removes the last element from the list: subject_list.pop(). The final list excludes the tuple's last element. Example:
Input tuple: ("Mathematics", "Physics", "Chemistry", "Biology")
Resulting list: ['Mathematics', 'Physics', 'Chemistry']
    
Was this answer helpful?
0

Top Questions on Commands and Requests