Python Forum

Full Version: Very basic coding issue
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I am teaching myself python and am in the very very beginning stages and have come across my first snag. I'm unsure why this code isn't working could use some help. I apologize for the simplicity of the help needed. Its just a simple input program for my kids but i cant figure out why I'm getting error.

Code:

print("Hello, my name is The Computer. What is yours?")

response = input()

pname = str(response)

if pname = "Noah" or pname = "noah":
    print(pname + "is a great name! Hello.")


if pname = "Damian" or pname = "damian":
    print("I once knew a dolphin named " + pname)
Thanks,
Matt
You need to use == for checking equality.

= is assignment.
Line 5 is unnecessary, as input already returns a string.
Ty all sorry such a noob question