-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalc.py
More file actions
32 lines (23 loc) · 856 Bytes
/
calc.py
File metadata and controls
32 lines (23 loc) · 856 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
#if 5,6,7 used it will work with the first number and wont ask for a second
#made by markthecoderguy on github
import math
num1 = int(input("number:\n "))
option = int(input("operation:\n1 for +\n2 for -\n3 for *\n4 for /\n5 for ²(square) \n6 for √(square root)\n7 for circumference of a circle(will work with diameter if chosen)\n "))
if option == 5:
print( float(num1 * num1) )
elif option == 6:
print(math.sqrt(num1))
elif option == 7:
print (float(num1) * (3.141592653589793238462643))
else:
num2 = int(input("number:\n "))
if option == 1:
print(num1 + num2)
elif option == 2:
print (float(num1 - num2))
elif option == 3:
print (float(num1 * num2))
elif option == 4:
print (float(num1 / num2))
else:
print("error")