Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/360.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
I';我试图仅使用while循环在python中编写此代码,但我不使用';我不知道它出了什么问题?_Python_Python 3.x - Fatal编程技术网

I';我试图仅使用while循环在python中编写此代码,但我不使用';我不知道它出了什么问题?

I';我试图仅使用while循环在python中编写此代码,但我不使用';我不知道它出了什么问题?,python,python-3.x,Python,Python 3.x,一个Python程序,它将在指定的时间间隔内输出所有Python三元组。(a,b,c)由三个整数a

一个Python程序,它将在指定的时间间隔内输出所有Python三元组。(a,b,c)由三个整数a
n=int(输入(“输入上限>10:”)
c=1
a=1
b=1
如果(a**2)+(b**2)==(c**2):
印刷品(a、b、c)
而(a**2)+(b**2)!=(c**2)和c
interval=[20,50]
a=间隔[0]

虽然你可能想重新表述这个问题…这有点让人困惑,但我只能使用while循环@jfsturtz为什么使用while循环?@astrosyam我正在尝试学习如何使用嵌套while循环。@jfsturtz感谢您的回答。我有一个问题,关于aSorry是怎么来的;我原本错过了那部分。类似于上面编辑的示例?它考虑了定义的时间间隔。它没有明确地说
n=int(input("Enter on upper bound> 10:"))
c=1
a=1
b=1
if (a**2) + (b**2) == (c**2):
print ( a, b, c)
while (a**2) + (b**2) != (c**2) and c<n :
    c=c+1
     while (a**2) + (b**2) != (c**2) and b<c:
        b=b+1
       while (a**2) + (b**2) != (c**2) and a<b:
         a=a+1
interval = [20, 50]

a = interval[0]
while a <= interval[1]:
    b = interval[0]
    while b <= interval[1]:
        c = interval[0]
        while c <= interval[1]:
            if (a**2 + b**2) == c**2:
                print(a, b, c)
            c += 1
        b += 1
    a += 1