+ 1

When I run this program I get "break outside loop" . can I know where I'm wrong?

import math print ('1. Find the area of square') print ('2. Find the area of rectangle') print ('3. Find the area of circle') print ("4.Exit") ch=int(input("Enter your choice")) if (ch==1): s=int(input('Enter length of the side')) a=s*s print('Area=',a) elif (ch==2): l=int(input('Enter length=')) b=int(input('Enter breadth=')) a=l*b print ('Area=',a) elif (ch==3): r=int (input ('Enter radius=')) a=2*math.pi*r print ('Area=', a) elif (ch==4): break

24th Jan 2021, 7:40 PM
Anonymous
Anonymous - avatar
2 Answers
+ 5
Well, you don't have a loop... Why do you need to check ch==4?
24th Jan 2021, 7:48 PM
Lisa
Lisa - avatar
+ 2
You dont need break.remove it. Also you can shorten the code e.g print(s*s)
25th Jan 2021, 4:06 AM
Angry Student(Docvad)
Angry Student(Docvad) - avatar