[go: up one dir, main page]

Menu

[213dd3]: / 1.0.py  Maximize  Restore  History

Download this file

148 lines (145 with data), 8.0 kB

  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
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
loop = 1
while loop == 1:
print ("---------------------------------------------------------------------")
print ("Welcome to TheJawaEyes' Python Calculator. Integers between 1 and 1000 with answers between those only please.")
print ("1 = Addition")
print ("2 = Subtraction")
print ("3 = Multiplication")
print ("4 = Division")
print ("5 = Powers")
print ("6 = Square Root")
print ("7 = Pi Calculations")
print ("8 = BONUS")
user_choice = int(input("Please choose your option:"))
if user_choice == 1:
addition = int (input("The number you want to add:"))
if len(str(addition)) > 3:
print ("The first number is too big!")
continue
addition2 = int (input("To this:"))
if len(str(addition2)) > 3:
print ("The second number is too big!")
continue
if len(str(addition + addition2)) > 3:
print ("The answer is too big!")
continue
print (addition, "+", addition2, "=", addition + addition2)
if user_choice == 2:
subtraction = int (input("The number you want to subtract:"))
if len(str(subtraction)) > 3:
print ("The number you want to subtract is too big!")
continue
subtraction2 = int (input("From this:"))
if len(str(subtraction2)) > 3:
print ("The number you want to subtract from is too big!")
continue
if len(str(subtraction2 - subtraction)) > 3:
print ("The answer is too big!")
continue
print (subtraction2, "-", subtraction, "=", subtraction2 - subtraction)
if user_choice == 3:
multiply = int (input("The number you want to multiply:"))
if len(str(multiply)) > 3:
print ("The first number you want to multiply is too big!")
continue
multiply2 = int (input("With this:"))
if len(str(multiply2)) > 3:
print ("The second number you want to multiply by is too big!")
continue
if len(str(multiply * multiply2)) > 3:
print ("The answer is too big!")
continue
print (multiply, "*", multiply2, "=", multiply * multiply2)
if user_choice == 4:
divide = int (input("The number you want to divide:"))
if len(str(divide)) > 3:
print ("The number you want to divide is too big!")
continue
divide2 = int (input("By this:"))
if len(str(divide2)) > 3:
print ("The number you want to divide by is too big!")
continue
if len(str(divide / divide2)) > 3:
print ("The answer is too big!")
continue
print (divide, "divided by", divide2,"=", divide / divide2)
if user_choice == 5:
power = int (input("The number you want to raise:"))
if len(str(power)) > 3:
print ("The number you want to raise is too big!")
power2 = int (input("To the power of:"))
if len(str(power2)) > 3:
print ("The power you want to raise by is too big!")
continue
if power2 == 1:
print (power, "to the power of", power2, "=", power ** power2)
if power2 == 2:
print (power, "squared", "=", power ** 2)
if power2 == 3:
print (power, "cubed", "=", power ** 3)
if power2 > 3:
print (power, "to the power of", power2, "=", power ** power2)
if len(str(power ** power2)) > 3:
print ("The answer is too big!")
continue
if user_choice == 6:
root = int (input("The number to find the square root of:"))
if len(str(root)) > 3:
print ("The number you want to square root is too big!")
continue
if len(str(root)) > 3:
print ("The answer is too big!")
continue
print ("The square root of", root, "is", root ** .5)
if user_choice == 7:
print ("1 = Add Pi")
print ("2 = Subtract Pi")
print ("3 = Subtract from Pi")
pi = int (input("Please choose an option:"))
if pi == 1:
pi_add = int (input("What would you like to add to Pi?"))
if len(str(pi_add)) > 3:
print ("The number you want to add to Pi is too big!")
continue
if len(str(pi_add + 3.14)) > 10:
print ("The answer is too big!")
continue
print (pi_add, "+", "Pi", "=", pi_add + 3.14)
if pi == 2:
pi_subtract1 = int(input("What would you like to subtract Pi from?"))
if len(str(pi_subtract1)) > 3:
print ("The number you want to subtract Pi from is too big!")
continue
if len(str(pi_subtract1 - 3.14)) > 10:
print ("The answer is too big!")
continue
print (pi_subtract1, "-", "Pi", "=", pi_subtract1 - 3.14)
if pi == 3:
pi_subtract2 = int(input("What would you like to subtract from Pi?"))
if len(str(pi_subtract2)) > 3:
print ("The number you want to subtract from Pi is too big!")
if len(str(3.14 - pi_subtract2)) > 10:
print ("The answer is too big!")
continue
print ("Pi", "-", pi_subtract2, "=", 3.14 - pi_subtract2)
if pi > 3:
print ("Please enter a valid option!")
continue
if pi < 1:
print ("Please enter a valid option!")
continue
if user_choice == 8:
print ("Speed Of Light Calculations (!yay!)")
print ("1 = Add the Speed Of Light")
print ("2 = Subtract the Speed Of Light")
spli = int(input("Please choose an option:"))
if spli == 1:
spliadd = int(input("What would you like to add to the Speed Of Light?"))
print (spliadd, "+", 299792458, "m/s", "=", spliadd + 299792458, "m/s")
if spli == 2:
splisub = int(input("What would you like to subtract the Speed Of Light from?"))
print (splisub, "-", "299792458 m/s", "=", splisub - 299792458, "m/s")
if user_choice > 8:
print ("Please enter a valid option!")
if user_choice < 1:
print ("Please enter a valid option!")