userInput = []
for i in xrange(1, 10):
userInput.append(raw_input('Enter the %s number: '))
userInput = ''
while len(userInput) != 1:
userInput = raw_input(':')
guessInLower = userInput.lower()
print"the numbers you have entered are: ", userInput
所以我试着做一个程序,接受10个单位数的输入,然后把它们放到一个字符串中,当它输入10个个个位数后,它就会打印出我到目前为止得到的所有个位数的输入,但是我找不到方法让它先检查。有什么建议吗?在
你应该把它放在一个循环中,然后检查输入是否是个位数:
根据您所说的,以下代码是您想要的:
演示repl.it
代码:
输出:
^{pr2}$相关问题 更多 >
编程相关推荐