- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalc.py
More file actions
Latest commit
32 lines (23 loc) · 856 Bytes
/
Copy pathcalc.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
importmath
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 "))
ifoption==5:
print( float(num1*num1) )
elifoption==6:
print(math.sqrt(num1))
elifoption==7:
print (float(num1) * (3.141592653589793238462643))
else:
num2=int(input("number:\n "))
ifoption==1:
print(num1+num2)
elifoption==2:
print (float(num1-num2))
elifoption==3:
print (float(num1*num2))
elifoption==4:
print (float(num1/num2))
else:
print("error")