-2

Obviously, I've just started trying to make some random programs, and do not know much. A program I have tried to write is the following:

print('Please print your name')
myName = input()
if myName == 'No'
print('Fine, be that way')

There is an error in the third line, and am not really sure why. How would I correct this?

3
  • 1
    This is probably a duplicate question. Did you google or something before you asked this question. This won't be received well here I'd imagine Commented Aug 27, 2016 at 5:18
  • Your code does not follow basic Python syntax. Please do at least minimal research by consulting a book or tutorial before asking a question. Commented Aug 27, 2016 at 5:55
  • Yeah I did do about 15 mins of googling, I think I probably wasn't searching for the right things though. Commented Aug 29, 2016 at 8:17

2 Answers 2

1

There's a syntax error in your code. The corrected code is:

print('Please print your name')
myName = input()
if myName == 'No':
    print('Fine, be that way')

Here's another question that should help you understand the syntax berter

Sign up to request clarification or add additional context in comments.

Comments

0

if statements require a colon as follows

if myName == 'No':
    print('Fine, be that way')

python scope is implied by indentation, so you'll need to indent the lines that you want to be conditional, such as the print

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.