Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import classes
- import numpy as np
- class Calcylator:
- def __init__(self, command = "gogo"):
- self.command = command
- def exit_calc(self, action_list):
- #print(len(action_list[0][:]))
- #print(len(action_list[:]))
- #
- #print(action_list[:][0])
- for x in action_list[:][0]:
- print(x)
- print("result!!!!!!!!!!!!!!!!!")
- #fixa utskriftsgrejjen vid avslut
- def run_calc(self):
- print("fuckrunt med listan")
- action_list = []
- def reg_printer(self, index):
- print(action_list[index].value)
- def wait_for_command(self):
- self.command = input("enter commands please :")
- def execute_command(self):
- print("execute commando: " + self.command)
- inputList = self.command.split()
- if ( len(inputList) == 3 ):
- print("hanterar 3 inputs")
- temp_reg = classes.Register(inputList[0])
- temp_val = classes.Value((inputList[2]))
- temp_ope = classes.Operation(inputList[1], temp_reg, temp_val)
- action_list.append((temp_reg, temp_ope, temp_val))
- elif (inputList[0].lower() == "quit"):
- print("hanterar 1 quit")
- elif (inputList[0].lower() == "print"):
- print("hanterar print")
- temp_reg = classes.Register(inputList[0])
- action_list.append(("print", temp_reg, 0 ))
- else:
- print("fel input, gör om gör rätt")
- print("Välkommen till Kalkylatorn!\n\n")
- while (self.command.lower() != 'quit'):
- wait_for_command(self)
- execute_command(self)
- Calcylator.exit_calc(self,action_list)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement