1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| print(tuple('121'))
print(list('abc'))
print(dict(a = 1,b = 2)) print(dict(zip(['a','b'],[1,2]))) print(dict((('a',1),('b',2))))
print(set([10,2,3,4,10])) print(set(range(10)))
print(frozenset([10,2,3,4,10])) print(frozenset(range(10)))
print(range(10)) print(range(1, 10)) print(range(1, 10, 1)) print(list(range(1, 10, 1))) for i in range(10): print(i)
seasons = ['Spring', 'Summer', 'Fall', 'Winter'] print(list(enumerate(seasons))) print(list(enumerate(seasons, start=1))) for index, i in enumerate(seasons): print(index, i)
seasons = ['Spring', 'Summer', 'Fall', 'Winter'] print(list(iter(seasons))) for i in iter(seasons): print(i)
|