我正在寫一個程序,使用50個州的字典。這個程序。會詢問用戶大約8個問題,在用戶回答問題後,會出現一些問題,比如「根據你的答案,你應該生活在這個狀態」。它是一個隨機輸出的狀態。問題會循環,直到用戶決定停止。這是我迄今爲止所做的。你能幫我嗎?謝謝蟒蛇字典的國家
import random
def main():
states = {
'Alabama','Alaska','Arizona','Arkansas','California','Colorado',
'Connecticut','Delaware','Florida','Georgia','Hawaii','Idaho',
'Illinois','Indiana','Iowa','Kansas','Kentucky','Louisiana',
'Maine' 'Maryland','Massachusetts','Michigan','Minnesota',
'Mississippi', 'Missouri','Montana','Nebraska','Nevada',
'New Hampshire','New Jersey','New Mexico','New York',
'North Carolina','North Dakota','Ohio',
'Oklahoma','Oregon','Pennsylvania','Rhode Island',
'South Carolina','South Dakota','Tennessee','Texas','Utah',
'Vermont','Virginia','Washington','West Virginia',
'Wisconsin','Wyoming'
}
print('What city are you from')
city = input()
print('What is your favorite team?')
team = input()
print('What state is close to you?')
state = input()
print('What is the name of your Governor?')
governor = input()
print('What is the name of your Senator?')
senator = input()
print('what is the name of your Sherif?')
sherif = input()
print('What is your favorite baseball team?')
baseball = input()
print('What is your favorite basketball team?')
basketball = input()
print('What is your favorite hockey team?')
hockey = input()
print ('Base on your answer the state you should live in is:' + states)
這是一組,嘗試'型(州)' – garg10may
正是如何或你在哪裏卡住了?你需要哪些幫助?你在尋找一對結對的伴侶嗎? – WhiteViking
我有這個工作。至於你的第三個問題,我確實需要一個編程夥伴。我真的想從-z – jay