-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?

  • 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 – Sam Orozco Aug 27 '16 at 05: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. – TigerhawkT3 Aug 27 '16 at 05:55
  • Yeah I did do about 15 mins of googling, I think I probably wasn't searching for the right things though. – Cameron Eggins Aug 29 '16 at 08:17

2 Answers2

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

Community
  • 1
  • 1
Prasanjit Prakash
  • 409
  • 1
  • 6
  • 21
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

derelict
  • 2,044
  • 10
  • 15