我的程序给出了一个NameError。这个错误让我困扰了很长一段时间,如果有人帮我回答,我会很感激。
Please input the first number: 30
Please input the second number: 6
Traceback (most recent call last):
File "/Users/2019_coen_ploeger/Documents/HS/Grade 9/Programming/Chapter 3/Project 3/Gcd.py", line 21, in <module>
if num1%div==1:
NameError: name 'div' is not defined
它背后的程序是。
num1=int(input('Please input the first number: '))
num2=int(input('Please input the second number: '))
#
if num1%div==1:
while div <= num1:
while div <= num2:
print(d)
else:
div-=1