我想創建一個「你最擅長哪個電視節目」。 但是,當它輸出哪個節目時,你應該將它們全部說出來。我該如何解決?Python人格測驗,如何顯示一個輸出而不是所有人
我不在乎我是否花了很長的路線來完成代碼 - 我只是想知道如何解決說一個答案。謝謝。
def quiz():
print("Hello- what is your name?")
name = input("Name: ")
print("Hello " + str(name) + ", I will be asking you some questions today to find out what television show you'd be best in.")
print(" ")
print("Are you ready?")
print("Please answer with YES or NO: ")
response = input()
if response.lower() == 'yes':
print(" ")
print("Alrighty then.")
print(" ")
print("Do you prefer to: ")
print(" ")
print("Laugh")
print("Think")
print("Fight")
print(" ")
q1 = input("Choose carefully: ")
print(" ")
print("Type of Villain?")
print(" ")
print("Supernatural")
print("Humans")
print("Social Pressure")
print(" ")
q2 = input("Death by: ")
print(" ")
print("Genre: ")
print(" ")
print("Action")
print("Comedy")
print("Drama")
print("Horror")
print(" ")
q3 = input("What will you pick: ")
print(" ")
print("You like to dress: ")
print("Trendy")
print("Casual")
print("Eccentric")
print("Elegantly")
print("Whatever I can get my hands on")
q4 = input("Fasionably...: ")
print(" ")
print("What would you use to defend yourself in a bad situation: ")
print("My own intelligence")
print("Bow and Arrows")
print("My teeth")
print("A sword or something sharp")
print("Electronic Device")
print("What bad situation...")
print("A gun")
q5 = input("Incidentally enough- pick your poison: ")
print(" ")
print("Which superower seems the best to you: ")
print("Super Strength")
print("Hyper-Observance")
print("Advanced Intelligence")
print("Invisibility")
print("Teleportation")
print("Telepathy")
print("Immortality")
q6 = input("Power: ")
if q1.lower() == 'laugh' or '1':
if q2.lower() == 'humans' or '2':
if q3.lower() == 'action' or 'comedy' or '1' or '2':
if q4.lower() == 'casual' or '2':
if q5.lower() == 'my own intelligence' or 'intelligence' or 'my' or 'own' or '1':
if q6.lower() == 'hyper-observance' or 'hyper' or 'observance' or '2':
print("Your television show is... Psych!")
if q1.lower() == 'think':
if q2.lower() == 'humans':
if q3.lower() == 'drama' or '3' or 'action' or '1':
if q4.lower() == 'elegantly' or '4':
if q5.lower() == 'a sword or something sharp' or 'a' or 'sword' or 'or' or 'something' or 'sharp' or 'something sharp' or '4' or 'bow and arrows' or 'bow' or 'arrows' or '2':
if q6.lower() == 'advanced intelligenct' or 'intelligence' or '3':
print("Your television show is... Game of Thrones!")
if q1.lower() == 'think' or '2' or 'fight' or '3':
if q2.lower() == 'humans' or '2' or 'social pressure' or 'social' or 'pressure' or '3':
if q3.lower() == 'comedy' or '2' or 'drama' or '3' and q4.lower() == 'trendy' or '1':
if q5.lower() == 'my own intelligence' or 'my' or 'own' or 'intelligence' or '1' or 'electronic device' or 'electronic' or 'device' or '5' or 'what bad situation?' or 'what' or 'bad' or 'situation' or 'what bad situation' or '6':
if q6.lower() == 'advanced intelligence' or 'intelligence' or '3' or 'telepathy' or '6':
print("Your television show is... Gossip Girl!")
if q1.lower() == 'think' or '2' or 'fight' or '3':
if q2.lower() == 'humans' or '2' or 'supernatural' or '1':
if q3.lower() == 'action' or 'drama' or '1' or '3':
if q4.lower() == 'casual' or '2' or 'whatever i can get my hands on' or '5':
if q5.lower() == 'my own intelligence' or 'intelligence' or 'my' or 'own' or '1' or 'a gun':
if q6.lower() == 'super strength' or 'super' or 'strength' or '1' or 'invisibility' or '4':
print("Your television show is... The Walking Dead!")
if q1.lower() == 'think' or '2' or 'fight' or '3':
if q2.lower() == 'supernatural' or '1' or 'humans' or '2':
if q3.lower() == 'action' or '1' or 'horror' or '4':
if q4.lower() == 'whatever i can get my hands on' or '5':
if q5.lower() == 'my' or 'own' or 'intelligence' or 'my own intelligence' or '1':
if q6.lower() == 'teleportation' or '5':
print("Your television show is... Lost!")
if q1.lower() == 'laugh' or '1':
if q2.lower() == 'social pressure' or 'social' or 'pressure' or '3':
if q3.lower() == 'comedy' or '2' or 'drama' or '3':
if q4.lower() == 'trendy' or '1' or 'casual' or '2':
if q5.lower() == 'what bad situation' or 'what' or 'bad' or 'situation' or 'what bad situation?' or '6':
if q6.lower() == 'telepathy' or '6':
print("Your television show is... Friends!")
if q1.lower() == 'think' or '2' or 'fight' or '3':
if q2.lower() == 'humans' or '2':
if q3.lower() == 'drama' or '3' or 'horror' or '4':
if q4.lower() == 'casual' or '2':
if q5.lower() == 'my own intelligence' or 'intelligence' or '1' or 'a gun' or 'gun' or '7':
if q6.lower() == 'hyper observance' or 'hyper' or 'observance' or '2' or 'telepathy' or '6':
print("Your television show is... Criminal Minds!")
if q1.lower() == 'think' or '2' or 'fight' or '3':
if q2.lower() == 'supernatural' or '1':
if q3.lower() == 'horror' or '4':
if q4.lower == 'casual' or '2':
if q5.lower() == 'my own intelligence' or 'intelligence' or '1' or 'electronice device' or 'electronic' or 'device' or '5':
if q6.lower() == 'telekinesis' or '8':
print("Your television show is... Stranger Things")
if q1.lower() == 'fight' or '3':
if q2.lower() == 'supernatural' or '1' or 'humans' or '2':
if q3.lower() == 'action' or '1' or 'drama' or '3':
if q4.lower() == 'eccentric' or '3' or 'casual' or '2':
if q5.lower() == 'bow and arrows' or 'bow' or 'arrows' or '2':
if q6.lower() == 'super strength' or 'super' or 'strength' or '1':
print("Your television show is... Arrow!")
if q1.lower() == 'fight' or '3':
if q2.lower() == 'supernatural' or '1':
if q3.lower() == 'drama' or '3' or 'horror' or '4':
if q4.lower() == 'trendy' or '1':
if q5.lower() == 'my teeth' or 'teeth' or '3':
if q6.lower() == 'immortality' or '7':
print("Your television show is... Vampire Diaries!")
elif response.lower() == 'no':
print("Goodbye then.")
else:
print("Please come back when you're not such a child.")
您不需要在此處轉儲所有代碼。瞭解如何創建[mcve]。訓練自己以最少量的代碼在新腳本中重現問題。你會學到很多東西。 –