-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcirclecalc.py
More file actions
35 lines (26 loc) · 967 Bytes
/
circlecalc.py
File metadata and controls
35 lines (26 loc) · 967 Bytes
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
28
29
30
31
32
33
34
35
import time
import math
def area(pi, radious):
return pi * radious ** 2
def circumference(pi, radious):
return 2*pi*radious
print("Select operation.")
print("1.Area")
print("2.Circumference")
while True:
choice = input("Enter choice(1)/(2): ")
if choice in ('1', '2'):
pi = float(input("Enter what you would like to use for pi: "))
radious = float(input("Enter the radious: "))
if choice == '1':
print(pi, "*", radious, "^", "2", "=", area(pi, radious))
elif choice == '2':
print(2, "*", pi, "*", radious, "=", circumference(pi, radious))
next_calculation = input("Let's do another calculation? (yes/no): ")
if next_calculation == "no":
print("Just run me again when you want to use me!")
print("Good bye!")
time.sleep(3)
break
else:
print("Invalid Input")