# Tuples are data structures that are
# not so easy to understand
moth_tuple = ('Hawk', 'Carpet', 'Pug')
moth_count = (28, 57, 32)
# print individual entries and summary
print('We have ' + str(len(moth_tuple)) + ' moth types')
print('The third moth type being ' + moth_tuple[2])
...
# but Tuples can contain mixed contents
mixed_tuple = ('Apple ', 'Pear', 20, '45.2')
# and tuples cannot be changed
# so the next line will force an error
# if you leave it in
# moth_tuple[2] = 'Snout'
...
# two more things
# running total using loop
moth_sum = 0
for curr_num in moth_count:
moth_sum = moth_sum + curr_num
print('In total ' + str(moth_sum) + ' moths')
# check if a moth is present
check_moth = input('Type moth search here - hint: Just answer Pug )')
if check_moth in moth_list:
print('yay we have a ' + check_moth)
else:
print('Missed!')