Crossin的编程教室

标题: 第7课作业 [打印本页]

作者: 文博    时间: 2018-2-2 17:21
标题: 第7课作业
自己编的,大神来帮忙看看行不行。另外,问一个特别傻的问题。在IDLE里每次编完一段想单独跑这段怎么操作?每次用F5就是全部跑了,刚接触,还不太熟悉。

word='big god'
print ("Who do you think I am?")
answer=input()

if answer==word:
   print("Oh, yes. You are right, man!")

if answer=='bad guy':
   print('No!I cannot agree with you!')

跑出来的结果就是:
==================== RESTART: C:\Users\文博\Desktop\Test.py ====================
Who do you think I am?
big god
Oh, yes. You are right, man!
others
Traceback (most recent call last):
  File "C:\Users\文博\Desktop\Test.py", line 14, in <module>
    thisIsLove = eval(input())
  File "<string>", line 1, in <module>
NameError: name 'others' is not defined
>>>
==================== RESTART: C:\Users\文博\Desktop\Test.py ====================
Who do you think I am?
bad guy
No!I cannot agree with you!
作者: crossin先生    时间: 2018-2-4 09:10
一个代码保存一个文件。你全写在一个里面当然不行了……




欢迎光临 Crossin的编程教室 (https://bbs.crossincode.com/) Powered by Discuz! X2.5