So I am newer to coding (only like 30% through the Python courses) and well just in doing it this is one of the first things I hit that I got really excited about. I took some notes from the first couple of lessons and I did my own thing just to play around… and well I wanted to show my girlfriend when I got home, but on some websites the code has a syntax error and on others it works fine. That brought me here. Is there a better way to type the code below? If so could you type it in a reply just so I can compare and contrast? I just want to do it the most efficient way and learn/know if I am doing an extra step I should not. Thanks all, I appreciate the help.
compliment = (raw_input)
if x == “Nino” or x == “nino”:
return “You are beautiful”
elif x == “Chris” or x == “chris”:
return “You are creative”
elif x == “Mark” or x == “mark”:
return “You are very nice”
return “I don’t know you.”
print compliment(raw_input("To whom am I speaking? "))
New note: So I think that the “compliment = (raw_input)” part is unnecessary (granted I am new at this).
Also wanted to add a clarifying statement. I am asking for an exemplar of this to compare/contrast with just for insight and curiosity. I am not asking for a curb for my enthusiasm or advice to ignore a question stuck in my mind.
P.S. Additional question… I tried typing my code with correct indentation in here but it did not show. I have seen some other posts where the indentation and colors show… how do I do that on the forums?
Thanks in advance.