
Python3 自習・復習vol.006
復習課題
years_list = [1980, 1981, 1982, 1983, 1984, 1985]
>>>
>>> years_list[3]
1983
>>>
>>> years_list[-1]
1985
>>>
>>> things = ['mozzarella', 'cinderella', 'salmonella']
>>> things
['mozzarella', 'cinderella', 'salmonella']
>>>
>>> things[1].capitalize()
'Cinderella'
>>> things
['mozzarella', 'cinderella', 'salmonella']
>>>
>>> things[0] = things[0].upper()
>>> things
['MOZZARELLA', 'cinderella', 'salmonella']
>>>
>>> del things[-1]
>>> things.append('ノーベル賞を受賞し(撲滅できればノーベル賞ものだろう)')
>>> things
['MOZZARELLA', 'cinderella', 'ノーベル賞を受賞し(撲滅できればノーベル賞ものだろう)']
>>>
>>> surprise = ['Grucho', 'Chico', 'Harpo']
>>> surprise[-1] = surprise[-1].lower()
>>> surprise[-1] = surprise[-1][::-1]
>>> surprise[-1] = surprise[-1].capitalize()
>>> surprise
['Grucho', 'Chico', 'Oprah']
>>>
>>> e2f = {'dog : chien', 'cat : chat', 'walrus : morse' }
>>> e2f['walrus']
'morse'
いいなと思ったら応援しよう!
