问答详情
源自:4-8 Python之嵌套循环

老师,这样写对吗?

# Enter a code

s1 = 'ABC'

s2 = '123'

s3 = 'xyz'

for x in s1:

    for y in s2:

        for z in s3:

            print(y+z+x)


提问者:qq_慕雪8584729 2021-03-18 20:33

个回答

  • weixin_慕先生9002666
    2021-03-29 16:55:27

    所有字符的排列是不是应该有x+y+z,x+z+y,y+x+z,y+z+x,z+x+y,z+y+x

  • 自学Python
    2021-03-19 08:05:33

    # Enter a code 改 # coding:utf-8
    按你代码print(x + y + z)

    代码是对的