diff --git a/calculator.py b/calculator.py index ff456112afa..6a8e823df59 100644 --- a/calculator.py +++ b/calculator.py @@ -27,9 +27,6 @@ ## Imported math library to run sin(), cos(), tan() and other such functions in the calculator -from fileinfo import raw_input - - def calc(term): """ input: term of type str @@ -76,18 +73,14 @@ def calc(term): # here goes to the error cases. except ZeroDivisionError: print("Can't divide by 0. Please try again.") - except NameError: print("Invalid input. Please try again") - except AttributeError: print("Please check usage method and try again.") except TypeError: - print("please enter inputs of correct datatype ") - + print ("Please only enter integers") return term - def result(term): """ input: term of type str @@ -109,21 +102,12 @@ def main(): "\nScientific Calculator\n\nFor Example: sin(rad(90)) + 50% * (sqrt(16)) + round(1.42^2)" + "- 12mod3\n\nEnter quit to exit" ) - - if sys.version_info.major >= 3: - while True: - k = input("\nWhat is ") - if k == "quit": - break - result(k) - - else: - while True: - k = raw_input("\nWhat is ") - if k == "quit": - break - result(k) - - -if __name__ == "__main__": +k = input("\nWhat is ") +if k == "quit" or "q": + result(k) +elif k == None: + print("Couldn't read input. Please try again.") +elif q == None: + print("Couldn't read input. Please try again.") +else: main() diff --git a/requirements_with_versions.txt b/requirements_with_versions.txt index cd9b7538c8f..9fdd04fdc82 100644 --- a/requirements_with_versions.txt +++ b/requirements_with_versions.txt @@ -54,6 +54,9 @@ background==0.2.1 pydantic==2.12.3 openpyxl==3.1.2 pytesseract==0.3.13 +pydantic==2.7.3 +openpyxl==3.1.5 +pytesseract==0.3.10 requests-mock==1.12.1 pyglet==2.1.9 urllib3==2.5.0