Jump to content

syntax error

Go to solution Solved by Tomic,

  File "python", line 9
    else print "empty"
             ^
SyntaxError: invalid syntax

 

thats the error

help im lerning python and this is a syntax error on line 9 please explain thanks 

 

1 print 'Welcome to the Pig Latin Translator!'
2
3
4 original = raw_input("Enter A Word:")
5
6 empty_string = ""
7 if len(original) > 0:
8   print "Thank You" 
9     else print "empty"
     

Red Fury: Cpu intel i5 4960k GPU 1060 6gb, Cooling  noctua dh15 storage 1tb sshd 250gb ssd mobo gigabyte z97p-3 case fractal r4 ram hyper x fury red 8 gb psu 550w xfx ts os win 10 monitor lg 25um56 

Link to comment
https://linustechtips.com/topic/417319-syntax-error/
Share on other sites

Link to post
Share on other sites

Could it be that 'else' doesn't need tabulating?

 

Start it from the first column instead of the third or something.

DAYTONA

PROCESSOR - AMD RYZEN 7 3700X
MOTHERBOARD - ASUS PRIME X370-PRO
RAM - 32GB (4x8GB) CORSAIR VENGEANCE LPX DDR4-2400
CPU COOLING - NOCTUA NH-D14
GRAPHICS CARD - EVGA NVIDIA GEFORCE GTX 980Ti SC+ ACX 2.0 w/ BACKPLATE
BOOT and PROGRAMS - CORSAIR MP600 1TB
GAMES and FILES - TOSHIBA 2TB
INTERNAL BACKUP - WESTERN DIGITAL GREEN 4TB
POWER SUPPLY - CORSAIR RM850i
CASE - CORSAIR OBSIDIAN 750D

Link to comment
https://linustechtips.com/topic/417319-syntax-error/#findComment-5612138
Share on other sites

Link to post
Share on other sites

  File "python", line 9
    else print "empty"
             ^
SyntaxError: invalid syntax

 

thats the error

Red Fury: Cpu intel i5 4960k GPU 1060 6gb, Cooling  noctua dh15 storage 1tb sshd 250gb ssd mobo gigabyte z97p-3 case fractal r4 ram hyper x fury red 8 gb psu 550w xfx ts os win 10 monitor lg 25um56 

Link to comment
https://linustechtips.com/topic/417319-syntax-error/#findComment-5612370
Share on other sites

Link to post
Share on other sites

i need to print the response to the question enter a word

Red Fury: Cpu intel i5 4960k GPU 1060 6gb, Cooling  noctua dh15 storage 1tb sshd 250gb ssd mobo gigabyte z97p-3 case fractal r4 ram hyper x fury red 8 gb psu 550w xfx ts os win 10 monitor lg 25um56 

Link to comment
https://linustechtips.com/topic/417319-syntax-error/#findComment-5612391
Share on other sites

Link to post
Share on other sites

@madknight3  i did but i need to print the response to the question 

Red Fury: Cpu intel i5 4960k GPU 1060 6gb, Cooling  noctua dh15 storage 1tb sshd 250gb ssd mobo gigabyte z97p-3 case fractal r4 ram hyper x fury red 8 gb psu 550w xfx ts os win 10 monitor lg 25um56 

Link to comment
https://linustechtips.com/topic/417319-syntax-error/#findComment-5613026
Share on other sites

Link to post
Share on other sites

@Tomic you really need to use code tags. You'd likely receive more help that way; for instance I don't even bother to read the topic if it's obvious that the OP hasn't even put any effort into its presentation i.e. not even reading the glaringly obvious announcement...

 

PZ20Fqo.png

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
https://linustechtips.com/topic/417319-syntax-error/#findComment-5614240
Share on other sites

Link to post
Share on other sites

@madknight3 i fixed it it needed a colon which i forgot. sorry for not using code tags @Nuluvius

Red Fury: Cpu intel i5 4960k GPU 1060 6gb, Cooling  noctua dh15 storage 1tb sshd 250gb ssd mobo gigabyte z97p-3 case fractal r4 ram hyper x fury red 8 gb psu 550w xfx ts os win 10 monitor lg 25um56 

Link to comment
https://linustechtips.com/topic/417319-syntax-error/#findComment-5631245
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×