Prince-linux / python-learning

for learning Python
MIT License
1 stars 0 forks source link

Discover tuples #13

Closed lcabrini closed 9 years ago

lcabrini commented 9 years ago

Tuples are similar to lists but are initialized slightly differently.

days = ('Mon', 'Tue', 'Wednes')
for d in days:
    print("I am always tired on %sdays" % (days))

There is a big difference however: lists are mutable, whereas tuples are immutable. We shall discover what that means in future tasks.

Create versions of days-of-the-week.py and months-of-the-year.py called dotw-tuple.py and moty-tuple.py that use tuples instead of lists. Place the files in the same folder as the list versions.