关于写作业发现的问题
1.有关random函数的使用的忘却
具体的用法
然后又是喜闻乐见的输入多个数据
进行深度解析一下
首先list函数的作用是建造一个列表
然后map
spilt
这样就完成了这个作业
关于狐狸游戏
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import random print ( "狐狸在1,2,3,4,5中的一个洞里面!!!!" ) n = int ( input ( "你打算抓那个洞里面的狐狸:" )) i = 0 a = 0 i = random.randint( 1 , 5 ) while i! = n: a = random.randint( 1 , 2 ) if a = = 1 and i ! = 5 : i + = 1 elif a = = 2 and i ! = 0 : i - = 1 else : continue if i = = n: continue else : print (i) n = int ( input ( "继续抓吧!" )) print ( '你抓到了!!!' ) |
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 字符编码:从基础到乱码解决