I created an interview with python, but -
i got coding. 1 of projects create smalltalk interview myself. went until :
if (sport == answer or sport == answer3 or sport == answer5): #yes if (vidgames == answer or vidgames == answer3 or vidgames == answer5): #yes print("so, " + name + ", i've learned, eat " + favfood + ", favorite color " + color + ", favorite sport(s) are/is " + favsport + ", , favorite video game(s) are/is " + favgame + ". interesting!") print() elif (sport == answer2 or sport == answer4 or sport == answer6): #no if (vidgames == answer2 or vidgames == answer4 or vidgames == answer6): #no print("so, " + name + ", i've learned, eat " + favfood + ", favorite color " + color + ", , don't play sports or video games. interesting!") print() elif (sport == answer or sport == answer3 or sport == answer5): #yes if (vidgames == answer2 or vidgames == answer4 or vidgames == answer6): #no print("so, " + name + ", i've learned, eat " + favfood + ", favorite color " + color + ", favorite sport(s) are/is " + favsport + ", don't play video games. interesting!") print() elif (sport == answer2 or sport == answer4 or sport == answer6): #no if (vidgames == answer or vidgames == answer3 or vidgames == answer5): #yes print("so, " + name + ", i've learned, eat " + favfood + ", favorite color " + color + ", favorite video game(s) are/is " + favgame + ", don't play sports. interesting!") print() farewell = input("well, " + name + ", must leave now. nice meeting you! hope meet again.")
if respond yes , no (or vice-versa), print message not show up. if respond same answers both of them, message show up. thing shows time "farewell" variable. thank helping me.
in case of yes , no: first checks see if first yes. finds is. checks see if second yes. not; proceeds next elif
. since elif
means else if
, finds came across true statement, (the first yes). why doesn't work. here cleaned-up version of code:
if sport in (answer, answer3, answer5): #yes if vidgames in (answer, answer3, answer5): #yes print("so, " + name + ", i've learned, eat " + favfood + ", favorite color " + color + ", favorite sport(s) are/is " + favsport + ", , favorite video game(s) are/is " + favgame + ". interesting!") print() elif vidgames in (answer2, answer4, answer6): #no print("so, " + name + ", i've learned, eat " + favfood + ", favorite color " + color + ", favorite sport(s) are/is " + favsport + ", don't play video games. interesting!") print() elif sport in (answer2, answer4, answer6): #no if vidgames in (answer2, answer4, answer6): #no print("so, " + name + ", i've learned, eat " + favfood + ", favorite color " + color + ", , don't play sports or video games. interesting!") print() elif vidgames in (answer, answer3, answer5): #yes print("so, " + name + ", i've learned, eat " + favfood + ", favorite color " + color + ", favorite video game(s) are/is " + favgame + ", don't play sports. interesting!") print() farewell = input("well, " + name + ", must leave now. nice meeting you! hope meet again.")
Comments
Post a Comment