diff --git a/calc.py b/calc.py index ed67502..e4a3b18 100644 --- a/calc.py +++ b/calc.py @@ -1,7 +1,7 @@ def main(): print("Welcome to the Calculator") command = input("Select command: [ + ] [ - ] [ * ] [ / ] \nType exit if u want exit \n") - match command: + match command: #выбор команд case "+": summ() case "*": @@ -18,7 +18,7 @@ def summ(): total = 0 while True: num_input = input() - if num_input == " ": + if num_input == " " or num_input == "": print (f"Total summ = {total}") main() try: @@ -43,7 +43,7 @@ def minus(): print("Error, enter correct number") def multiplication(): print("Enter number to multiplication, enter space to calculate") - total = 0 + total = 1 while True: num_input = input() if num_input == " ": @@ -55,5 +55,6 @@ def multiplication(): print(f"Total multiplication = {total}") except ValueError: print("Error, enter correct number") + if __name__ == "__main__": - main() + main() #запуск функции main, основа программы \ No newline at end of file