[Tutor] multiple objects with one assignment?

Brandon Dorsey brandontdr at gmail.com
Fri Jan 2 11:25:12 CET 2015


I know there is are easier ways to assign multiple objects to a variable,
but why, does the following code work?  Why does it return a tuple versus a
list?  I know it has something to do with the semi-colon, but I didn't know
it wouldn't  raise an error.

greetings = "hello,", "what's", "your", "name?"
print(greetings)

x = 1, 2, 3, 4, 5, 6, 7
print(x)

I assumed that you could only assign one object per assignment without the
presence of tuples, list, or dictionaries.


More information about the Tutor mailing list