Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Very basic coding issue
#1
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
Reply
#2
You need to use == for checking equality.

= is assignment.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#3
Line 5 is unnecessary, as input already returns a string.
Reply
#4
Ty all sorry such a noob question
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Basic Coding Question: Exit Program Command? RockBlok 3 554 Nov-19-2023, 06:31 PM
Last Post: deanhystad
  [split] Very basic coding issue aary 4 2,451 Jun-03-2020, 11:59 AM
Last Post: buran
  Basic example Coding gudlur46 2 2,041 Dec-19-2019, 01:55 PM
Last Post: gudlur46
  Python Coding Issue! ankitdixit 3 89,197 Sep-25-2019, 06:31 AM
Last Post: rohanjoshi0894
  Coding issue 1557676 2 29,959 Aug-02-2019, 08:54 PM
Last Post: cvsae
  Basic coding question with Python Than999 3 3,100 Jul-17-2019, 04:36 PM
Last Post: jefsummers
  Basic List Issue rogueakula 1 2,178 May-18-2019, 06:01 PM
Last Post: snippsat
  Hey guys can you please help me with some basic coding Stabu 9 6,254 Jul-16-2017, 10:11 AM
Last Post: MyImpsNamesAre
  New member with simple coding issue shaikh 0 2,985 Apr-24-2017, 05:28 PM
Last Post: shaikh
  coding issue Lee 2 3,484 Feb-13-2017, 10:53 AM
Last Post: Lee

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020