python循环结构问题怎么办

img


# 第一题
weight = 50
for i in range(1, 11):
  weight += 1.2
  print('第{}年体重:{}'.format(i, round(weight, 2)))

# 第二题
for i in range(1, 10):
  print('aa' * i)

# 第三题
n = int(input('n的值:'))
m = int(input('m的值:'))
count = 0
while n <= m:
    count = count + n
    n += 1
print('第二题,while循环:', count)

n = int(input('n的值:'))
m = int(input('m的值:'))
count = 0
for i in range(n, m+1):
    count = count + i
print('第二题,for循环:', count)

# 第四题
n = int(input('n的值:'))
if n % 2 != 0:  # (a)
    if n == 1:
        print('1')
    else:
        str1 = '1'
        for i in range(3, n+1, 2):
            str1 = str1 + '+{}'.format(i)
        print('奇数', str1)

else:  # (b)
    str2 = '1'
    for i in range(2, n+1):
        if i % 2 != 0:
            str2 = str2 + '-{}'.format(i)
        else:
            str2 = str2 + '+{}'.format(i)
    print('偶数', str2)

# (c)
str3 = '1/1'
if n == 1:
    print(str3)
else:
    for i in range(2, n+1):
        str3 = str3 + '+{}/{}'.format(i, n)
    print(str3)

你的问题是什么?