Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Can you te3ll me how to fix the syntax error?

+3 votes
asked Apr 19, 2022 by Венелин Насков (150 points)
a = float(input('Въведете дължината на първата страна: '))  

b = float(input('Въведете дължината на втората страна: '))  

c = float(input('Въведете дължината на третата страна: '))  

s = (a + b + c) / 2  

Area = (s*(s-a)*(s-b)*(s-c)) ** 0.5  

print('Площта на триъгълника е' %Area)

if area > 0

  st= "Има такъв триъгълник"

else:

st= "Няма триъгълник"

print(st)

it says that the sytnax error is in the if statement , next to the 0

2 Answers

+2 votes
answered Apr 20, 2022 by Peter Minarik (84,720 points)
edited Apr 21, 2022 by Peter Minarik

Here are some errors:

  1. Variable names are case sensitive (area is not the same as Area).
  2. In the if statement you need to close the condition with a colon (:)
  3. Indentation is important. Indent always the same amount when opening a new scope (e.g. in a body of an if statement).
  4. The correct syntax for printing multiple elements in the print() function is to separate them via comas.

Your code correctly:

a = float(input('Въведете дължината на първата страна: '))  
b = float(input('Въведете дължината на втората страна: '))  
c = float(input('Въведете дължината на третата страна: '))  
s = (a + b + c) / 2  

Area = (s*(s-a)*(s-b)*(s-c)) ** 0.5  

print('Площта на триъгълника е', Area)

if Area > 0:
    st = "Има такъв триъгълник"
else:
    st = "Няма триъгълник"

print(st)
0 votes
answered Apr 21, 2022 by MANUJA BHOOMI (140 points)
you didn't put the round brackets for your condition in if statement

the correction will be --->  if (area>0)

i hope this helps
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...