鱼C论坛

 找回密码
 立即注册
楼主: 小甲鱼

[课后作业] 第002讲:用Python设计第一个游戏 | 课后测试题及答案

    [复制链接]
发表于 2024-5-26 19:03:21 | 显示全部楼层
请回复您的答案^_^

-------- 问答题 --------

第 0 题的答案是:交互模式即时反馈每条代码的结果,编辑器模式是先写脚本,完成后整体进行运行

第 1 题的答案是:int?

第 2 题的答案是:不一样,刚尝试了Print在交互模式无法输出

第 3 题的答案是:150

第 4 题的答案是:暂时还没发现

第 5 题的答案是:if guess后面只有一个=号,应该用2个

-------- 动动手 --------

请将第 0 题的代码写在下方:

365*24*60*60
31536000

请将第 1 题的代码写在下方:
temp=input("请输入本次数学考试的成绩:")
guess=int(temp)

if guess==100:
    print("好棒,你离女神又近了一步^_^")
else:
    print("小子,想要幸福,就得努力!")
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2024-5-26 22:50:46 | 显示全部楼层
请回复您的答案^_^

-------- 问答题 --------

第 0 题的答案是:交互模式是输入代码后有反馈的方式,编辑器模式是可以编辑代码的一种方式,在交互模式中点Flie-New Flie可以打开

第 1 题的答案是:int()

第 2 题的答案是:不一样

第 3 题的答案是:>>> dir(__builtins__)
['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning', 'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError', 'ConnectionRefusedError', 'ConnectionResetError', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False', 'FileExistsError', 'FileNotFoundError', 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError', 'InterruptedError', 'IsADirectoryError', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'ModuleNotFoundError', 'NameError', 'None', 'NotADirectoryError', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecationWarning', 'PermissionError', 'ProcessLookupError', 'RecursionError', 'ReferenceError', 'ResourceWarning', 'RuntimeError', 'RuntimeWarning', 'StopAsyncIteration', 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'TimeoutError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning', 'ValueError', 'Warning', 'WindowsError', 'ZeroDivisionError', '__build_class__', '__debug__', '__doc__', '__import__', '__loader__', '__name__', '__package__', '__spec__', 'abs', 'all', 'any', 'ascii', 'bin', 'bool', 'breakpoint', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', 'compile', 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'exec', 'exit', 'filter', 'float', 'format', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'quit', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip']

第 4 题的答案是:增加空格?

第 5 题的答案是:"""用Python设计第一个游戏"""

temp=input("不妨猜一下小甲鱼现在心里想的是哪个数字:")
guess=int(temp)

if  guess==8:
    print("你是小甲鱼心里的蛔虫嘛?!")
    print("哼,猜中了也没奖励!")
else:
    print("猜错啦,小甲鱼现在心里想的是8!")
   
print("游戏结束,不玩啦^_^")


-------- 动动手 --------

请将第 0 题的代码写在下方:
365*24*60*60
31536000


请将第 1 题的代码写在下方:
"""用Python设计第一个游戏"""

temp=input("这次数学考试成绩:")
code=int(temp)

if  code==100:
    print("好棒,你离女神又近了一步^_^")
else:
    print("小子,想要幸福,就得努力!")
   
print("游戏结束,不玩啦^_^")
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2024-5-27 08:54:54 | 显示全部楼层
请回复您的答案^_^

-------- 问答题 --------

第 0 题的答案是:

第 1 题的答案是:

第 2 题的答案是:

第 3 题的答案是:

第 4 题的答案是:

第 5 题的答案是:

-------- 动动手 --------

请将第 0 题的代码写在下方:



请将第 1 题的代码写在下方:
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2024-5-27 16:04:16 | 显示全部楼层
请回复您的答案^_^

-------- 问答题 --------

第 0 题的答案是:
交互模式写一个代码反馈一个,编辑器模式即相反。
第 1 题的答案是:
int if   else
第 2 题的答案是:
不一样,print是打印已有数据,print是用户编辑。
第 3 题的答案是:
154
第 4 题的答案是:
不知道
第 5 题的答案是:
没看出啊
-------- 动动手 --------

请将第 0 题的代码写在下方:
print (365*24*60*60)
31536000


请将第 1 题的代码写在下方:
temp = input("这次数学考试成绩:")
guess =int(temp)

if guess == 100:     
    print("好棒,你离女神又近了一步")

else:
    print("小子,想要幸福,就得努力!")
print("游戏结束不玩了")
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2024-5-27 17:00:02 | 显示全部楼层
1
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2024-5-27 17:24:57 | 显示全部楼层
1
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2024-5-27 17:29:43 | 显示全部楼层
1
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2024-5-27 21:11:52 | 显示全部楼层
本帖最后由 niclfly 于 2024-5-27 21:18 编辑

请回复您的答案^_^

-------- 问答题 --------

第 0 题的答案是:
交互模式代码是保存在内存中的,编辑器模式代码是保存在硬盘上的,交互模式是敲入一条指令解释一条指令,编辑器模式是代码完成后,解释器在一行一行解释。
第 1 题的答案是:
if,esle
第 2 题的答案是:
print()和print()没看出哪不一样
第 3 题的答案是:
159使用len(dir(__builtins__))得到
第 4 题的答案是:
不知道
第 5 题的答案是:
if guess = 8:不对,应该是==
-------- 动动手 --------

请将第 0 题的代码写在下方:
365*24*3600


请将第 1 题的代码写在下方:
"""说说你的分数"""


temp = input("输入你的分数:")
guess = int(temp)

if 100 <= guess:
    print("好棒,你离女神又进了一步")
   
else:
    print("想要幸福,你好需要继续努力哦")

print("game over!")
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2024-5-27 21:22:31 | 显示全部楼层
请回复您的答案^_^

-------- 问答题 --------

第 0 题的答案是:

第 1 题的答案是:

第 2 题的答案是:

第 3 题的答案是:

第 4 题的答案是:

第 5 题的答案是:

-------- 动动手 --------

请将第 0 题的代码写在下方:



请将第 1 题的代码写在下方:
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2024-5-27 21:58:49 | 显示全部楼层
请回复您的答案^_^

-------- 问答题 --------

第 0 题的答案是:
交互式:直接输出结果
编译器:需要保存为py文件,运行之后查看结果

第 1 题的答案是:
dir(__builtins__)
第 2 题的答案是:

第 3 题的答案是:
['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BaseExceptionGroup', 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning', 'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError', 'ConnectionRefusedError', 'ConnectionResetError', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EncodingWarning', 'EnvironmentError', 'Exception', 'ExceptionGroup', 'False', 'FileExistsError', 'FileNotFoundError', 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError', 'InterruptedError', 'IsADirectoryError', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'ModuleNotFoundError', 'NameError', 'None', 'NotADirectoryError', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecationWarning', 'PermissionError', 'ProcessLookupError', 'RecursionError', 'ReferenceError', 'ResourceWarning', 'RuntimeError', 'RuntimeWarning', 'StopAsyncIteration', 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'TimeoutError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning', 'ValueError', 'Warning', 'ZeroDivisionError', '__build_class__', '__debug__', '__doc__', '__import__', '__loader__', '__name__', '__package__', '__spec__', 'abs', 'aiter', 'all', 'anext', 'any', 'ascii', 'bin', 'bool', 'breakpoint', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', 'compile', 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'exec', 'exit', 'filter', 'float', 'format', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'quit', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip']
第 4 题的答案是:

第 5 题的答案是:
if guess == 8:

-------- 动动手 --------

请将第 0 题的代码写在下方:

second_of_year =(365*24*60*60)
print(second_of_year)

请将第 1 题的代码写在下方:
temp = input("这次数学考试成绩:")
score = int(temp)

if score ==100:
    print("好棒,你离女神又近了一步^_^")

else:
    print("小子,想要幸福,就得努力!")

print("游戏结束,不玩啦^_^")
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2024-5-28 10:32:12 | 显示全部楼层
请回复您的答案^_^

-------- 问答题 --------

第 0 题的答案是:交互模式一给指令就立刻有反馈,编辑器模式需要通过ctrl+n打开,或在file-new file下打开,可以在编辑器输入代码,交互模式执行

第 1 题的答案是:交互模式下,输入dir(_builtins_)打开python所有的内置函数,如 'tuple', 'type', 'vars', 'zip'

第 2 题的答案是:不一样,变量名是区分大小写的

第 3 题的答案是:

第 4 题的答案是:

第 5 题的答案是:python中,等于的运算符用"=="来表示,guess==8才构成正确的条件语句

-------- 动动手 --------

请将第 0 题的代码写在下方:



请将第 1 题的代码写在下方:
"""课后作业"""
temp = input("这次数学考试成绩:")
guess = int(temp)


if guess == 100:
    print("好棒,你离女神又近了一步^_^")
else:
    print("小子,想要幸福,就得努力!")

print("游戏结束,不玩啦^_^")
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2024-5-28 10:37:23 | 显示全部楼层
请回复您的答案^_^

-------- 问答题 --------

第 0 题的答案是:

第 1 题的答案是:int()

第 2 题的答案是:print()用于打印输出一个对象,Print输入会报错

第 3 题的答案是:68

第 4 题的答案是:自动填充

第 5 题的答案是:

-------- 动动手 --------

请将第 0 题的代码写在下方:
>>> 365*24*60*60
31536000


请将第 1 题的代码写在下方:
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2024-5-28 15:57:59 | 显示全部楼层
请回复您的答案^_^

-------- 问答题 --------

第 0 题的答案是:我们打开 IDLE 出现的界面就是交互模式编程界面,在 Python 提示符后输入代码并回车,会立马看到代码运行效果;而编辑器模式需要创建.py 文件,在其中写代码,写完一行代码不会立即看到运行效果,写完所有代码并保存.py 文件,最后运行该文件才会看到运行效果。

第 1 题的答案是:int

第 2 题的答案是:不一样

第 3 题的答案是:159

第 4 题的答案是:不知道

第 5 题的答案是:guess==8

-------- 动动手 --------

请将第 0 题的代码写在下方:



请将第 1 题的代码写在下方:
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2024-5-28 16:54:19 | 显示全部楼层
请回复您的答案^_^

-------- 问答题 --------

第 0 题的答案是:不知道

第 1 题的答案是:range()

第 2 题的答案是:不一样

第 3 题的答案是:56

第 4 题的答案是:不知道

第 5 题的答案是:应该是==

-------- 动动手 --------

请将第 0 题的代码写在下方:



请将第 1 题的代码写在下方:
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2024-5-28 17:27:28 | 显示全部楼层
1
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2024-5-28 17:27:48 | 显示全部楼层
1
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2024-5-28 17:29:10 | 显示全部楼层
1
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2024-5-28 17:29:41 | 显示全部楼层
1
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2024-5-28 19:41:18 | 显示全部楼层
请回复您的答案^_^

-------- 问答题 --------

第 0 题的答案是:交互模式你给他一个指令他立即给你一个反馈

第 1 题的答案是:int()

第 2 题的答案是:不一样

第 3 题的答案是:158个

第 4 题的答案是:

第 5 题的答案是:因为1个"="是赋值操作

-------- 动动手 --------

请将第 0 题的代码写在下方:
365*24*60*60


请将第 1 题的代码写在下方:
guess = int(input("这次数学考试成绩:"))
if guess == 100:
    print("好棒,你离女神又近了一步")
else:
    print("小子,想要幸福,就得努力!")
print("游戏结束,不玩啦")

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2024-5-28 20:25:53 | 显示全部楼层
1
2请回复您的答案^_^

-------- 问答题 --------

第 0 题的答案是:

第 1 题的答案是:

第 2 题的答案是:

第 3 题的答案是:

第 4 题的答案是:

第 5 题的答案是:

-------- 动动手 --------

请将第 0 题的代码写在下方:



请将第 1 题的代码写在下方:
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-6-26 12:15

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表