diff --git a/README.md b/README.md index 4de1607..955d845 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ -calculator +calculator in python ========== -Calculator implemented in Python \ No newline at end of file +Calculator implemented in Python +This calculator is created in python.Through which you will learn the bacis of the operators, if else and many things. + +Not only the bacis but you will be learning the ERROR HANDLING, OOPs, and many more. +the best thing about this calculator is that you only have to give the expression which means that not only calculation between two numbers but you can give as much as operators and operands as you want to give as a input diff --git a/calculator.py b/calculator.py index 205adc7..fa068f0 100755 --- a/calculator.py +++ b/calculator.py @@ -15,7 +15,7 @@ def printTokens(tokens): expressions = '' while iterator != len(tokens): if tokens[iterator].getType() == TokenType.NUMBER_TOKEN: - print "Number:\t\t", + print "The Number = \t\t", print tokens[iterator].getValue() expressions += str(tokens[iterator].getValue()) + ' ' elif tokens[iterator].getType() == TokenType.OPERATOR_TOKEN: @@ -62,4 +62,7 @@ def main(): if __name__ == '__main__': - main() + try: + main() + except Exception as e: + pass diff --git a/scanner.py b/scanner.py index 258fc4a..aea703c 100755 --- a/scanner.py +++ b/scanner.py @@ -2,8 +2,11 @@ #Comp 141, Homework 7 #Python Calculator (calculator.py) -from calcExceptions import CalcExceptions -import token +try: + from calcExceptions import CalcExceptions + import token +except Exception as e: + pass #Scanner Class #Takes in user input and splits into tokens