October 7, 2020 at 12:00 am
Comments posted to this topic are about the item Unpacking a List in Python
October 7, 2020 at 12:09 am
Just a heads up, it looks like one of the answer options didn't populate in the textbox correctly.
Here's the exception for the question option, if it's not too late:
This will not work. A ValueError will be raised with the following exception:
ValueError: not enough values to unpack (expected 4, got 3)
October 8, 2020 at 6:07 am
Hadn't got to this in my Python Ed. I can see this being useful.
October 9, 2020 at 6:55 am
Learned something new!
I knew about this one:
t = ['a', 'b', 'c']
print(*t)
The unpacking thing is cool, can put the asterisk in the middle too:
for name in [("First","Last"), ("First", "Middle1", "Middle2", "Last")]:
first, *middle, last = name
print(f"{first}, {middle}, {last}\n-----")
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy