/
diev
/
swaroopch-byte-of-python
Обзор
Документация
Войти
/
diev
/
swaroopch-byte-of-python
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
programs/ds_using_tuple.py
14 строк
632 B
d-s-1
Tuples
31 авг 2017, 06:10
31 авг 2017, 06:10
39ce648
Код
Авторство
О чём код?
# I would recommend always using parentheses # to indicate start and end of tuple # even though parentheses are optional. # Explicit is better than implicit. zoo = ('python', 'elephant', 'penguin') print('Number of animals in the zoo is', len(zoo)) new_zoo = 'monkey', 'camel', zoo # parentheses not required but are a good idea print('Number of cages in the new zoo is', len(new_zoo)) print('All animals in new zoo are', new_zoo) print('Animals brought from old zoo are', new_zoo[2]) print('Last animal brought from old zoo is', new_zoo[2][2]) print('Number of animals in the new zoo is', len(new_zoo)-1+len(new_zoo[2]))