Python Tuple Unpacking Presentation


This is the presentation associated with the python Tuple Unpacking video.

Download Presentation

Python Tuple Unpacking Video Question

This is the question that was asked in the python tuple unpacking video:

Question:

Write the code to produce the desired output:

names = ("Bill", "Steve","Tim", "John")

Desired Output:

firstname = Bill
lastname = John
Others = ['Steve', 'Tim']
In [1]:
names = ("Bill", "Steve","Tim", "John")
firstname, lastname, *Others = names

print("firstname =",firstname)
print("lastname =",lastname)
print("Others =",Others)
firstname = Bill
lastname = Steve
Others = ['Tim', 'John']