100k views
11 votes
[Python] Spot the errors in the code

x = int(input()
if x == 5
print(x is equal to 5)
else:
print("x is not equal to 5")

User Cricket
by
7.9k points

1 Answer

4 votes

Answer:

  1. There's no string double quotes in the print statement on line 3.
  2. The input statement on line 1 is wrong. It should actually be the following ⇒ print(input(Hello World))

All print statements must contain double quotes around a string. Otherwise, it will be interpreted as a number, and will lead to an error.

User Mononz
by
7.5k points

No related questions found

Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.