Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- # BEGIN (write your solution here)
- x = input('x=')
- figure = input('figure=')
- square = 0.0
- try:
- x = float(x)
- except:
- print ('error')
- exit(1)
- if x <= 0:
- print ('error')
- exit(1)
- if figure == 'circle':
- square = math.pi * x * x
- print ('The area is %.2f' % square)
- exit(0)
- elif figure == 'square':
- square = x * x
- print ('The area is %.2f' % square)
- exit(0)
- else:
- print ('error')
- exit(1)
- # END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement