我在理解python中的循环时遇到了一些问题。另外,我在理解如何在Python测试作业中添加循环时遇到了问题。有人能给我这个问题的指导吗。下面是我在python多项选择测验中的当前代码。在
from datetime import datetime
now = datetime.now()
# showing the current date you're taking the quiz
print("Today's Date is:")
print('%s/%s/%s' % (now.month, now.day, now.year))
print("")
#this will print out my welcome statement and ask you for your name
print('Hello welcome to my Quiz, what is your name?')
#definied the variable username so that the user could type in their name
usersname = input()
print ("")
print('It is nice to meet you, ' + usersname)
print("")
level = input ('Please select a difficulty (easy, medium, or hard): ')
print("")#I just used this to add some space between my lines
print("")#I just used this to add some space between my lines
#these are my questions
easy_questions= ["What is 20 + 2 __1__", "What is the capital of Georgia__2__","If john has $4 and buys a candy bar for $3.50, how much money does he have left over__3__","What is the name of the NBA basketball team in Georgia__4__","What is the name of the NFL team in Georgia__5__","How many toys do I have if I sell 3, but had 8 toys originally__6__","How many Bad Boy movies are there__7__","How many Fast Furious movies are there__8__","What is 10 * 5 __9__","What city does the UGA team play in__10__"]
medium_questions= ["What is 20 + 2 __1__", "What is the capital of Georgia__2__","If john has $4 and buys a candy bar for $3.50, how much money does he have left over__3__","What is the name of the NBA basketball team in Georgia__4__","What is the name of the NFL team in Georgia__5__","How many toys do I have if I sell 3, but had 8 toys originally__6__","How many Bad Boy movies are there__7__","How many Fast Furious movies are there__8__","What is 10 * 5 __9__","What city does the UGA team play in__10__"]
hard_questions= ["What is 20 + 2 __1__", "What is the capital of Georgia__2__","If john has $4 and buys a candy bar for $3.50, how much money does he have left over__3__","What is the name of the NBA basketball team in Georgia__4__","What is the name of the NFL team in Georgia__5__","How many toys do I have if I sell 3, but had 8 toys originally__6__","How many Bad Boy movies are there__7__","How many Fast Furious movies are there__8__","What is 10 * 5 __9__","What city does the UGA team play in__10__"]
循环是非常基本的(在任何语言中),所以我强烈建议您仔细阅读。这里有一个有用的链接:https://www.tutorialspoint.com/python3/python_loops.htm
你可以这样做:
相关问题 更多 >
编程相关推荐