I have a simple jumble style game. I already made a mess, but now I want to add a "hint" system. I do not know how to show 1 element from tuples. I have 2 tuples, and I want to extract from the second tuple, based on what the first tuple is. I have WORD=("x", "y", "z")and HINT=("x", "y", "z"). When the user enters "hint", I want the program to return the appropriate value from HINT. I tried:
for h in HINT:
if guess=="hint":
print h
Obviously this does not work and just prints all the HINT values.
If I had:
hints=dict(zip(WORDS, HINT))
if guess=="hint":
print "Here a hint:", hints[correct]
while (guess !=correct) and (guess != ""):
print "Sorry, that not the answer."
guess=raw_input("Your guess: ")
guess=guess.lower()
if guess==correct:
print "That it! You guessed it!\n"
print "Thanks for playing."
would there be some way to make me NOT print "Sorry, this is not so."? (also, the word "right" is here)
source
share