Catch fox game 抓狐狸Python代码实现

Catch fox game 抓狐狸Python代码实现
实验描述
Write a program to simulate a fox catching game. Suppose there are a total of 5 holes in a row. The little fox is initially in one of the holes, and then the player opens a hole randomly. If there is a fox in it, he catches it. If there are no foxes in the hole, they will come again the next day, but the next day the fox will jump to the next hole before the player comes.
编写程序,模拟抓狐狸小游戏。假设一共有一排5 个洞口,小狐狸最开始的时候在其中一个洞口,然后玩家随机打开一个洞口,如果里面有狐狸就抓到了。如果洞口里没有狐狸就第二天再来抓,但是第二天狐狸会在玩家来抓之前跳到隔壁洞口里。
实验目的

  1. Develop the ability to analyze problems and model them.
  2. Skillfully use lists to solve practical problems.
  3. Skillfully use the selection structure and cyclic structure to solve practical problems.
  4. Understand the execution flow of the loop structure with an else clause.
  5. Understand the use of exception handling structures to constrain user input.
    1、培养分析问题并对进行建模的能力。
    2、熟练使用列表解决实际问题。
    3、熟练运用选择结构和循环结构解决实际问题。
    4、理解带else 子句的循环结构执行流程。
    5、理解使用异常处理结构约束用户输入的用法。
    上代码
from random import *
def mai():
    print(
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序员阿诺斯

您的打赏是我创作路上最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值