Question

python ./age.py Desktop File ./age.py, line 1 >>> print(Hello World) SyntaxError: invalid syntax

I'm trying to simply print hello world but it's giving me invalid syntax when I try to run it from the terminal and I dont understand why.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

You should remove >>> that you have put in age.py file.
File should contain just the below line

print('Hello World')

I guess you got confused with looking in the terminal.
If you type python, then >>> comes automatically in the terminal.
So, if you type below directly, it prints the output

print('Hello World')

But you shouldn't put >>> in file when you write python code


-- Please up vote or comment if you have any doubts. Happy Learning!

Add a comment
Know the answer?
Add Answer to:
I'm trying to simply print hello world but it's giving me invalid syntax when I try...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hello! I'm posting this program that is partially completed if someone can help me out, I...

    Hello! I'm posting this program that is partially completed if someone can help me out, I will give you a good rating! Thanks, // You are given a partially completed program that creates a list of employees, like employees' record. // Each record has this information: employee's name, supervisors's name, department of the employee, room number. // The struct 'employeeRecord' holds information of one employee. Department is enum type. // An array of structs called 'list' is made to hold...

  • Hello... please answer these questions for me, with detailed working so that I can understand how...

    Hello... please answer these questions for me, with detailed working so that I can understand how you did it. Thank you : ) 1.-15 points My Notes A hollow sphere of radius a has uniform surface charge density σ and is centered at the origin. It sits inside a bigger sphere, also centered at the origin, with radius b > a and uniform surface charge density-o. Because of the spherical symmetry, the electric field will have the form E (i)-E(r)...

  • Hello, I am doing a WACC project of Apple, Inc and trying to follow the instruction...

    Hello, I am doing a WACC project of Apple, Inc and trying to follow the instruction below, but I do not think it is clear enough for me to follow. Calculating the Weighted Average Cost of Debt Find the market value of each bond issue. To do this find the number of bonds and then multiply by the price of the bond (remember that bond prices are quoted in 100s, but are really 1000s). If there is no bond price,...

  • could you please help me with this problem, also I need a little text so I...

    could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT