은 파이썬 3을 시도하고 잠시 루프와 연습을하고 있지만 변수가 기본 Ywhile 루프가 오 탐지를 반환하는 이유는 무엇입니까?
#!/usr/bin/python3
elements = [];
copy = [];
rot=0;
op='y';
ap='y';
while op is 'y' or 'Y':
elements = [];
a = int(input("How many elements? "));
for i in range(a):
elements.append(input("Enter element " + str(i+1) + " "));
while ap is 'y' or 'Y':
rot = int(input("How many element to rotate? "));
print(elements);
copy = elements[-rot:] + elements[:-rot];
elements = copy;
print(elements);
ap = input("Rotate again? ");
op = input("Create a new rotatrix? ");
또한 https://stackoverflow.com/questions/1504717/why-does-comparing-strings-in-python-using-either-or-is-sometimes-produce – vaultah
이 중 하나를합니까 대답에는 OR 연산자가 포함됩니까? – userDepth
예, 첫 번째 링크를 참조하십시오. – vaultah