找回密码
 中文实名注册
搜索
楼主: admin

【Python作业】第三单元 第7课 小熊摘桃 综合项目

[复制链接]

1

主题

15

回帖

2396

积分

金牌会员

积分
2396
发表于 2021-12-11 11:48:34 | 显示全部楼层

回帖奖励 +40 金钱

  1. tree = 0
  2. total = 0
  3. while True:
  4.     tree = tree + 1
  5.     if tree % 3 !=0:
  6.         total = total + tree
  7.     print(tree)
  8.     print(total)
  9.     if total >= 120:
  10.         print('第'+str(tree)+'棵的时侯摘够了')
  11.         break
复制代码
回复

使用道具 举报

3

主题

38

回帖

827

积分

高级会员

积分
827
发表于 2021-12-11 11:43:18 | 显示全部楼层
tree = 0
total = 0
while True:
    tree = tree + 1
    total = total + tree
    print(tree)
    print(total)
    if total >= 120:
        break
论坛我最帅
回复

使用道具 举报

2

主题

15

回帖

1443

积分

金牌会员

积分
1443
发表于 2021-12-11 11:40:01 | 显示全部楼层

回帖奖励 +40 金钱

tree = 0
total = 0

while True:
    tree = tree + 1
    if tree % 3 !=0
    total = total + tree
    print(tree)
    print(total)
    if total >= 120(tree)
    print('第' + str(tree) + '棵的时候摘啦')
回复

使用道具 举报

0

主题

23

回帖

-161

积分

限制会员

积分
-161
发表于 2021-12-11 11:39:08 | 显示全部楼层

回帖奖励 +40 金钱

tree = 0
total = 0
while True:
    tree = tree + 1
    if tree % 3!=0:
        total = total + tree
    print(tree)
    print(total)
    if total >= 120:
        print('第'+str(tree)+'棵的时候摘够了')
        break
回复

使用道具 举报

3

主题

27

回帖

660

积分

高级会员

积分
660
发表于 2021-12-11 11:37:11 | 显示全部楼层

回帖奖励 +40 金钱

tree = 0
total = 0
while True:
    tree = tree + 1
    if tree % 3!=0:
        total = total + tree
    print(tree)
    print(total)
    if total >= 120:
        print('第'+str(tree)+'棵的时候摘够了')
        break
回复

使用道具 举报

6

主题

41

回帖

3268

积分

论坛元老

积分
3268
发表于 2021-12-11 11:30:15 | 显示全部楼层

回帖奖励 +40 金钱

本帖最后由 许睿辰 于 2021-12-11 11:43 编辑
  1. <div class="blockcode"><blockquote>tree = 0
  2. total = 0
  3. while True:
  4.     tree = tree + 1
  5.     if tree % 3 != 0:
  6.         total = total + tree
  7.     print(tree)
  8.     print(total)
  9.     if total >= 120:
  10.         print('第' + str(tree) + '棵的时候摘够了')
  11.         break
复制代码

回复

使用道具 举报

3

主题

69

回帖

78

积分

版主

积分
78
发表于 2021-12-11 11:29:34 | 显示全部楼层

回帖奖励 +40 金钱

tree = 0
total = 0
while True:
    tree += 1
    if tree % 3 != 0:#把除以3等于0的数(3的倍数)排除
        total = total + tree
    if total >= 120:
        print(f'第{tree}棵的时候摘够啦')
        break

回复

使用道具 举报

3

主题

38

回帖

827

积分

高级会员

积分
827
发表于 2021-12-11 11:29:22 | 显示全部楼层

回帖奖励 +40 金钱

tree = 0
total = 0
while True:
    tree = tree + 1
    if tree % 3 != 0:
        total = total + tree
    if total >= 120:
        print('第' + str(tree) + '棵的时候摘够了')
        break
论坛我最帅
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 中文实名注册

本版积分规则

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