0
これは私が使用しているコードですが、私はそれを実行しようとするたびに、私はターミナルで、このエラーが表示されます。私のコードNameError:名前 'pets'は定義されていません。 PYTHON
Traceback (most recent call last):
File "ex11.py", line 16, in <module>
if pets == "y":
NameError: name 'pets' is not defined
:
print "So, how are you doing today?"
emotion = raw_input()
if "Good" in emotion:
print "Cool! I love when people are \"good\"! It makes me feel all fuzzy inside. ^-^"
print "Do you have any pets? y/n."
pets = raw_input()
if pets == "y":
print "Awesome! I have always wanted a pet! What kind do you have? What does it look like?"
pet_type = raw_input()
ヒント:感情の「良い」が「偽」を返すとどうなりますか? –