问答详情
源自:4-7 Python之continue继续循环

请问哪里错了呀

# Enter a code

s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

num = 10

for ch in s:

    if num>=10

    print(ch)

    num = num + 1


结果

提问者:索罗斯7922145 2022-04-24 11:51

个回答

  • 慕运维3303162
    2022-09-01 17:32:49

    print那一行缩进有问题,前面的if语句后面没有: 说明你if语句就不完整

  • 米兰豆浆
    2022-05-06 11:52:45

    s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

    num = 0

    for ch in s:

        if num >= 10:

            print(ch)

        num = num + 1


  • 还得是你正哥
    2022-04-27 10:28:41

    s ='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    num = 1
    for ch in s:
        if num>=10:
            print(ch)
            num = num + 1
        else:
            num = num + 1

  • 远足鸟
    2022-04-24 11:57:06

    if 后面没有冒号,print要indent