为什么调用checkInteger函数时程序没有处理
def main():
print("Kaylees Prime Number Checker")
numChoice = int(input("Please type a number: "))
checkInteger()
def checkInteger(numChoice):
if number % 2 == 0:
print("Your number is not prime. ")
else:
print("Your number is prime.")
main()
您必须将一个参数传递给函数checkInteger,因为它被定义为在您的定义中使用一个参数
看起来您需要checkInteger的参数,还应该命名参数编号,或者将编号更改为numChoice。无论哪种方式,都必须是相同的
相关问题 更多 >
编程相关推荐