English

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. - Computer Science (Python)

Advertisements
Advertisements

Question

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. 

Short Answer

Solution

SubLst=list(subject)
SubLst.pop()

Explanation: The tuple is transformed into a list using the list() method. The final member in the list is removed by the pop() function. 

shaalaa.com
  Is there an error in this question or solution?
2023-2024 (February) Set 4
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×