+ 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
2 Respostas
+ 5
Well, you don't have a loop... Why do you need to check ch==4?
+ 2
You dont need break.remove it.
Also you can shorten the code e.g print(s*s)