-1

I would implement a simple program that tries to guess which word have you chosen among the available ones, based on your hints. This is what I have done so far:

print('you have 2 words you can give hints of, Panda, or bucket ')
term = ('china','chinese','bamboo','bear','panda','black','white',
        'black and white','cute','adorable','big','ying and yang')
hint1 =input('Give me a hint   ')
if term in hint1:
    print('I think it is a panda!')

Right now I am stuck on the panda part and it raises the following error:

Traceback (most recent call last):

File "/Users/edwardandreilucaciu/Documents/guesser.py", line 4, in <module>
    if term in hint1:
TypeError: 'in <string>' requires string as left operand, not tuple

Can someone please help me?

2
  • All of these edits have removed important pieces of code each time. As it stands, term is undefined. Commented Mar 29, 2019 at 19:20
  • @JordanSinger Look at the (former) slider at the bottom of the code block. The definition of term was pushed off the right side. Commented Mar 29, 2019 at 19:31

1 Answer 1

1

You just needed to flip the order of your variables in your if statement:

print('you have 2 words you can give hints of, Panda, or bucket ')
term = ('china','chinese','bamboo','bear','panda','black','white',
        'black and white','cute','adorable','big','ying and yang')

hint1 =input('Give me a hint ')
if hint1 in term:
    print('I think it is a panda!')
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.