妹妹猪 发表于 2020-5-9 09:18:36

"""用while循环输出1~30的元组"""

n = 1
while n <= 30:
    print((n, n+1, n+2))


    n = n + 3

燕子的东先生啊 发表于 2020-5-9 13:27:12

学习一下

落叶飘飞 发表于 2020-5-10 09:41:44

i=1
while i<=30:
    if i%3==0:
      n=(i-2,i-1,i)
      print(n)

    i+=1

神秘小帅哥 发表于 2020-5-10 14:37:10

>>> x = 1
>>> while x< 30:
      print((x,x+1,x+2))
      x += 3

有谁懂 发表于 2020-5-11 10:52:23

i = 1

while i <= 30:
    a = i
    b = i + 1
    c = i + 2
    i += 3
    print(tuple())

BXQXX 发表于 2020-5-11 11:15:11

>>> x = 1
>>> while x< 30:
      print((x,x+1,x+2))
      x += 3

琉璃琉璃 发表于 2020-5-12 00:05:54

x = 1
while x <= 30:
    print((x,x+1,x+2))
    x += 3

WD湿 发表于 2020-5-14 17:15:03

YY啦啦啦啦

ForPorsche 发表于 2020-5-18 19:29:52

i = 1
while i < 31:
    print((i,i+1,i+2))
    i += 3

笑叹, 发表于 2020-5-20 22:50:46

{:10_256:}

噗呲。 发表于 2020-5-21 10:17:48

感谢楼楼分享的练习题.赞赞赞!

0623009 发表于 2020-5-21 20:44:34

方法①
for i in range(1,29,3):
    print((i,i+1,i+2))
方法②
i=1
while i <= 28:
    print((i,i+1,i+2))
    i+=3

遁天入地1412 发表于 2020-5-22 17:12:07

{:5_109:}

Commongg 发表于 2020-5-22 20:29:16

i=1
s=(i,i+1,i+2)
while i+2<=30
    print(s)
    i+=3

Commongg 发表于 2020-5-22 20:31:15

i=1
s=(i,i+1,i+2)
while i+2<=30
    print(s)
    i+=3

Commongg 发表于 2020-5-22 20:46:59

Commongg 发表于 2020-5-22 20:31
i=1
s=(i,i+1,i+2)
while i+2<=30


不对?

Commongg 发表于 2020-5-22 22:06:38

n=1
while n+2 <= 30:
      print((n,n+1,n+2))
      n += 3

ok

一定学好python 发表于 2020-5-25 15:45:30

'''x = 1
while x< 30:
      a=(x,x+1,x+2)
      print(tuple(a))
      x += 3'''

zwhe 发表于 2020-5-26 15:50:09

{:10_304:}

噗呲。 发表于 2020-5-30 11:16:38

i = 3

while i <= 30:
    print((i-2,i-1,i))
    i += 3
页: 1 2 3 [4] 5
查看完整版本: 小白Python练习册(3)【鱼币福利】