calculator. code example

Example 1: calculator

A calculator is a device that helps you calculate math problems.

Example 2: calculator code

x = input("first number")
y = input("second number")
z = input("do you want to multiply, minus, divide or add? (x,-,/,+)")

y = int(y)
x = int(x)

if z == "+":
    print (x + y)

if z == "/":
    print (x / y)

if z == "x":
    print (x * y)

if z == "-":
    print (x - y)

else:
    print("use x,-,/ or + next time!")

Example 3: calculator

class calc:
  def __init__(self,num):
    self.num = num
  def __add__(self,other):
    #inner code
  def __mul__(self, other):
    #inner code
  def __sub__(self, other):
    #inner code
  def __div__(self,other):
    #inner code
  # and so on for features

Example 4: calculator

cheater lol

Tags:

Css Example