Skip to content

Instantly share code, notes, and snippets.

@anthony-y
Last active March 31, 2016 17:55
Show Gist options
  • Save anthony-y/b3431eb3e5dcaae7bf0a to your computer and use it in GitHub Desktop.
Save anthony-y/b3431eb3e5dcaae7bf0a to your computer and use it in GitHub Desktop.
A very simple yet functional calculator in ~20 lines.
# calc.py
# Simple calculator.
from os import system as s
nextNum = None
operations = []
def getNextNumber():
nextNum = input(">> ")
operations.append(float(nextNum))
while True:
print "Console Calculator by Anthony Baynham"
getNextNumber()
for i in operations:
print i
s("pause")
del operations[:]
s("cls")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment