我开始编写代码
from random import randint, shuffle
numbers = {1:'\u4e00', 2:'\u4e8c', 3:'\u4e09', 4:'\u56db', 5:'\u4e94', \
6:'\u516d', 7:'\u4e03', 8:'\u516b', 9:'\u4e5d', 10:'\u5341'}
x=randint(1,10)
print('Welcome to our quiz on Chinese/Japanese numerals.')
input('What is the Value of ' +numbers[x] +'?' )
if 1 == '\u4e00' :
print('Congratulations! Let us continue then, consider:')
else:
print( 'Congratulations! Let us continue then, consider:')
input (['\u4e00', '\u4e8c', '\u4e09', '\u56db','\u4e94', \
'\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341'])
input ('At which position is the value of ' +numbers[x] +'?' )
代码的if和else部分有问题。我已经能够通过问第一个问题和插入随机的汉字来设置测验的开始,但是我有一个问题,接下来是“错误答案,等于”语句的一部分。如何确定用户在提示符中插入的内容是正确的还是不正确的?你知道吗
捕获变量中的输入值,并执行等价性测试:
相关问题 更多 >
编程相关推荐