0

Okay, I wrote a simple calculator, not in GUI form, but a calculator for simple stuff. So I'm wondering, would this layout be considered OO? I think this is how it works. Now I do know that I didn't use an object to handle the class since it just wasn't necessary. Now I know that making a class wasn't totally necessary for this program, but I'm just curious if this would be the general layout. So here's the code:

```
import os
import math
import fractions
if os.name == "nt":
os.system("color 48")
os.system("title Calculator")
def clear():
os.system("cls")
else:
def clear():
os.system("clear")
class Calc:
def menu():
clear()
print ("Welcome to calculator!")
print ("----------------------")
print ("1) Exponents ")
print ("2) Division ")
print ("3) Multiplication ")
print ("4) Addition ")
print ("5) Subtraction ")
print ("6) Square Root ")
print ("7) Simplify Fractions ")
print ("8) Factors ")
print ("9) Exit ")
print ("----------------------")
menu = str(input("Choose one: "))
if ( menu in list("123456789") ) == False:
clear()
print ("Please type a valid option!")
input ()
Calc.menu()
methods[int(menu)-1]()
def exp():
clear()
print ("? to the - power equals -")
p1 = int(input())
print ()
print (p1, "to the ? power equals -")
p2 = int(input ())
print ()
p3 = pow(p1, p2)
print (p1, "to the", p2, "power equals", p3)
input ()
Calc.menu()
def div():
clear()
print ("? divided by - equals -")
d1 = int(input())
print ()
print (d1, "divided by ? equals -")
d2 = int(input())
print ()
d3 = d1/d2
if (d1 % d2) == 0:
d3 = int(d3)
print (d1, "divided by", d2, "equals", d3)
input ()
Calc.menu()
def times():
clear()
print ("? multiplied by - equals -")
m1 = int(input())
print ()
print (m1, "multiplied by ? equals -")
m2 = int(input())
print ()
m3 = m1*m2
print (m1, "multiplied by", m2, "equals", m3)
input ()
Calc.menu()
def add():
clear()
print ("? plus - equals -")
a1 = int(input())
print ()
print (a1, "plus ? equals -")
a2 = int(input())
print ()
a3 = a1+a2
print (a1, "plus", a2, "equals" ,a3)
input ()
Calc.menu()
def minus():
clear()
print ("? minus - equals -")
s1 = int(input())
print ()
print (s1, "minus ? equals -")
s2 = int(input())
print ()
s3 = s1-s2
print (s1, "minus", s2, "equals", s3)
input ()
Calc.menu()
def square():
clear()
print ("The Square Root of ? is -")
sqrt1 = int(input())
sqrt2 = math.sqrt(sqrt1)
if ( str(sqrt2).split(".")[1] ) == "0":
sqrt2 = int(sqrt2)
print ()
print ("The Square Root of", sqrt1, "is", sqrt2)
input ()
Calc.menu()
def frac():
clear()
print ("?/- simplified is -/-")
fr1 = int(input())
fr11 = str(fr1)
print ()
print (fr11 + "/- simplified is -/-")
fr2 = int(input())
fr22 = str(fr2)
print ()
fr3 = fractions.Fraction(fr1, fr2)
fr33 = str(fr3)
print (fr11 + "/" + fr22, "simplified is", fr33)
input ()
Calc.menu()
def factors():
clear()
f = int(input("Type the number you would like to find the factors of: "))
f2 = []
for f1 in range(f + 1):
if f1 != 0:
if (f % f1) == 0:
f2.append(str(f1))
print ("The factors of", f, "are", ",".join(f2))
input ()
Calc.menu()
methods = [
Calc.exp,
Calc.div,
Calc.times,
Calc.add,
Calc.minus,
Calc.square,
Calc.frac,
Calc.factors
]
Calc.menu()
```

*Edited
by AutoPython*: n/a