Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- def help():
- print("To operate the program, simply type a number, hit enter, type one of the following operations: (*, /, x, +, -, ^)\n")
- print("These operations will allow you to calculate. For commands you can enter after receiving a result from an operation, you can now type 'commands' for a list of commands.")
- print("=========================================================")
- commands = {'help':'- displays help documentation to user.', 'exit':'-closes the program.'}
- def commands():
- for key, value in dict.commands():
- print(key, value)
- main()
- def exit():
- print("Exiting...")
- time.sleep(3)
- def numeral(x):
- print("Enter an operator or command:")
- second = str(input())
- if second == '*':
- print("Enter another number to be operated on:")
- third = input()
- if type(third) == int or float:
- third = float(third)
- x = float(x)
- x = x * third
- print(x)
- numeral(x)
- else:
- print("You did not enter a number. Taking you back to main menu.")
- time.sleep(5)
- main()
- #x is the newly entered data. y is the first numeral entered and will be saved between functions as navigation around. z will be the last operator entered.
- def main(x,y,z):
- global entry
- global first
- global op
- print("Welcome to Spencer's Calculator v2.\n Either enter the first number you wish to work with and hit 'Enter' or type 'help' for what you can do.")
- first = input("Enter a float value or a command: ")
- if first == 'commands':
- commands()
- numeral(first)
- main('0',0,'0')
Add Comment
Please, Sign In to add comment