-2

Need help on the week three "Driving Me Crazy" question. I've got it to work for any variation of yes, but it doesn't work when the 'yes' is in the middle of the reply. e.g. if the reply is "Ummm oh yes here we are". Here's what I got so far

print("Let's go!")
There = input('Are we there yet? ')
Answer = There.lower()
while Answer != 'yes':
  print('Aww...')
  There = input('Are we there yet? ')
  Answer = There.lower()
print('Hooray!!!')
Jlajr
  • 7
  • Try this: https://stackoverflow.com/questions/3437059/does-python-have-a-string-contains-substring-method – Sergio Tulentsev Aug 10 '20 at 10:06
  • Does this answer your question? [Does Python have a string 'contains' substring method?](https://stackoverflow.com/questions/3437059/does-python-have-a-string-contains-substring-method) – Tomerikoo Aug 10 '20 at 10:10
  • 2
    Not all people (me included) are familiar with what is Grok 2020 week 3 "Driving Me Crazy" question. You should give a short, concise explanation of what is the problem you are trying to solve (or at least provide a link to it) – Tomerikoo Aug 10 '20 at 10:12

1 Answers1

2

You might use in for checking if given string is substring of another string, i.e. change your while to:

while 'yes' not in Answer:
Daweo
  • 31,313
  • 3
  • 12
  • 25