#Initialising Variables
inputISBN = input("What is your 10 digit ISBN number? ")
itemInList = 0
timesNumber = 11
listISBN = []
timesISBN = []
#Checking if the input is only numbers
if len(inputISBN) == 10 and inputISBN.isdigit() :
while itemInList < 10 :
listISBN.append(inputISBN[itemInList])
itemInList = itemInList + 1
print(listISBN)
itemInList = 0
while itemInList < 10 :
num = listISBN[itemInList]
int(num)
timesISBN.append(num * timesNumber)
itemInList = itemInList + 1
timesNumber = timesNumber - 1
print(timesISBN)
else:
print("Invalid input")
HALP它只需打印输入数字11次,然后再打印10次 对不起,没有什么要说的了,我必须补充更多的细节。 此代码旨在将输入乘以11,然后乘以10,以此类推,但它只将数字复制了那么多。我不明白为什么这不起作用
以下是一种更简单的方法:
您需要存储
int()
调用的返回值;除此之外,num
值不受影响:相关问题 更多 >
编程相关推荐