0

I wrote this very simple code, it doesn't work and I can't understand why. I answer 'good' but if part doesn't work!

def howdy ():
    p = input("how's it going?")
    if p is "good":
        print("Cheers")
howdy()
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245

2 Answers2

0

You have to use:

If p == 'good':

The == compares the value of the two. The Is keyword checks for identity by comparing the memory address.

Hope this explains it enough. Hannes

Hannes
  • 311
  • 3
  • 9
-1

have you tried

if p == "good":

the double equal means the same as. Also, if you are looking for a helpful free beginner course, try codecademy. They helped me loads learn python

Cam92
  • 21
  • 4