Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
How to fix indentation error
Post Body

I'm writing a while loop with if statements in it. When I get to the end of one of the if statements I want to break the loop. However when I put in the break command for the first if statement it says there is an indentation error. This is the only line I have this problem with. It is line 17.

from math import sqrt

s = True

while (s is True): print('The sides are a, b, c and c is the hypotenuse') formula = input('Which side (a, b, c) do you wish to calculate? side> ')

if formula == 'c': side_a = int(input('Input the length of side a: ')) side_b = int(input('Input the length of side b: '))

  side_c = sqrt(side_a * side_a   side_b * side_b)

  print('The length of side c is' )
  print(side_c)
break 

elif formula == 'a': side_b = int(input('Input the length of side b: ')) side_c = int(input('Input the length of side c: '))

side_a = sqrt((side_c * side_c) - (side_b * side_b))

print('The length of side a is' )
print(side_a)
break

elif formula == 'b': side_a = int(input('Input the length of side a: ')) side_c = int(input('Input the length of side c: '))

side_b = sqrt(side_c * side_c - side_a * side_a)

print('The length of side b is')
print(side_b)
break

else: print ("Please Try Again") s is True code

Author
User Disabled
Account Strength
0%
Disabled 1 year ago
Account Age
5 years
Verified Email
Yes
Verified Flair
No
Total Karma
1,175
Link Karma
858
Comment Karma
236
Profile updated: 3 days ago
Posts updated: 1 year ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
4 years ago