-5

I basically have to print true or false if the name 'Riley' is in my list... This is what I have:

if 'Riley' ??? names3:
    return True
else:
    return False
M. Dodd
  • 5
  • 3

1 Answers1

2

Use the in keyword.

>>> names = ['Will', 'Dodd', 'Harry']
>>> print 'Will' in names
True
>>> print 'Barry' in names
False
Will
  • 4,299
  • 5
  • 32
  • 50