250,933 views
13 votes
13 votes
Can anyone tell me how this is a SyntaxError! (Python/coding)

Can anyone tell me how this is a SyntaxError! (Python/coding)-example-1
User Pritesh Shah
by
2.4k points

1 Answer

29 votes
29 votes

Answer:

The expression on line 9 requires 2 brackets

Step-by-step explanation:

Given

The attached code

Required

Why syntax error.

On line 9 of the program, we have::

amount = int(input("Enter cheese order weight: ")

The instruction on line 9 gets an integer input from the user. However, this is incorrectly done

To get an integer input, the syntax is:

variable-name = int(input("Prompt"))

By comparing the syntax to the actual code on line 9, only 1 of the brackets is closed.

In Python 3, this is counted as a syntax error

User Abahgat
by
3.3k points