dictionary型とBoolean型の演習中
本日も演習中。
なかなかに良い。
>>> me = {'height':180} >>> me['height'] 180 >>> me['weight'] = 70 >>> me {'weight': 70, 'height': 180} >>> hungry = True >>> sleepy = False #眠い?True,Falseは先頭大文字か? >>> type(hungry) <class 'bool'> >>> angry = false #怒っている?小文字でやるとどうなるのかな Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'false' is not defined >>> not hungry #ダメみたいね。notでの否定を実行 False >>> hungry and sleepy False >>> hungry or sleepy #OR条件ですね。 True >>>