PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# This is my first Python code... Please like it! I worked really hard...
from math import pi
radius = ""
result = 0
arOrCi = {"area": "**", "circumference": "*"}
while type(radius) != type(2.0):
print("Enter the radius length!")
try:
radius = float(input())
except:
print("Try again!")
print("Area or Circumference?")
choose=input()
if choose.lower() == "area" or choose.lower() == "circumference":
result = str(eval("pi * radius"+arOrCi[choose]+"2"))
result = str(result)
print("The "+ choose.lower() +" is " + result)
else:
print("You have to choose what the program should calculate. Press RUN and type in Area or Circumference")
# Be sure to type in the radius, then the Area or Circumference.
# Leave a like if you enjoy it :)
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run