212,650 views
27 votes
27 votes
What is the result when you run the following line of code after a prompt? >>> print "Good job"

User Chinnychinchin
by
3.0k points

2 Answers

23 votes
23 votes

Final answer:

Running the code print "Good job" in Python 2.x will display 'Good job' on the screen. In Python 3.x, it would cause a syntax error due to missing parentheses.

Step-by-step explanation:

When the line of code print "Good job" is run in Python 2.x after a prompt, the result will display the text Good job to the standard output, which is typically the screen. It's worth noting that this particular syntax with the print statement without parentheses is specific to Python 2.x. In Python 3.x and above, the correct syntax would be print("Good job"), with the text to be printed enclosed in parentheses. Therefore, if you run the first command in Python 3.x or later, you will encounter a syntax error, prompting you to correct the code with the proper syntax.

User James Cooke
by
2.9k points
22 votes
22 votes

Answer:

You will get line "Good job" itself

User Nupadhyaya
by
2.7k points