如何创建用户菜单并从不同的问题中进行选择 [英] How to create a user menu and have choice from different questions

查看:83
本文介绍了如何创建用户菜单并从不同的问题中进行选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

print( "Hello and welcome to my Quiz\n")



ans= True
while ans:
        print('''''
        1.Soccor Questions
        2.Science Questions
        

        Press enter to quit
        ''')
ans=input("Select a Question Package")
if ans== "1":
        print("You have choosen Soccor Questions")
        elif ans=="2":
        print("You have choosen Science Questions")
        

#Soccor Questions
one = input("All four home nations – England, Scotland, Wales and Northern Ireland – played at the 1958 World Cup. Where did it take place?\n")
two = input("How many of the 20 clubs in MLS are based in Canada?\n")
three = input("In which country would you find the world's largest football stadium (by capacity)?\n")
four = input("In 2002 on the same day as the World Cup final, 'The Other Final' took place between the world's two lowest ranking nations. Who won the game?\n")
five = input("Who finished the 2014-15 Ligue 1 season as top scorer?\n")
six = input("Which club have won the most Serie A titles?\n")


#Science Questions
seven = input("Brass gets discoloured in air because of the presence of which of the following gases in air?\n")
eight = input("Chlorophyll is a naturally occurring chelate compound in which central metal is ?\n")


#Answer to Soccor Questions
onea = "Sweeden"
twoa = "Three"
threea = "North Korea"
foura = "Bhutan"
fivea = "Alexandre Lacazette"
sixa = "Juventus"

#Answers to Science Questions
sevena = "Hydrogen sulphide"
eighta = "Bromine"            




print("")

# User will be notified if answer is correct or wrong
if one == onea:
	print("1.This is correct")
else:
	print("1.Wrong Answer")
	
if two == twoa:
	print("2.This is correct")
else:
	print("2.Wrong Answer")
	
if three == threea:
	print("3.This is correct")
else:
	print("3.Wrong Answer")
	
if four == foura:
	print("4.This is correct")
else:
	print("4.Wrong Answer")

if five == fivea:
        print("5.This is correct")
else:
        print("5.Wrong Answer")

if six == sixa:
        print("6.This is correct")
else:
        print("6.Wrong Answer")

if seven == sevena:
        print("7.This is correct")
else:
        print("7.Wrong Answer")

if eight == eighta:
        print("8.This is correct")
else:
        print("8.Wrong Answer")







我的尝试:



i试图查看字典和列表,但没有希望a我不太明白它我想知道如何选择soccor问题到科学问题并将它们与他们的答案联系起来任何帮助请作为我只是python的新手?




What I have tried:

i have tried looking at dictionary and list but got no hope as i didnt quite understand it i want to know how to choose from soccor questions to science questions and relate them to their answers any help please as im only a newbie at python ??

推荐答案

Python教程 - Python 3.3.6文档开始[ ^ ]。


这篇关于如何创建用户菜单并从不同的问题中进行选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆