+ 2

whats wrong with this code?

the code should, in the end, output the result of the operation but, it isn't even recognizing the operations correctly and, the sum, "auto-related" itself to simple_calculator import time greatings = ("\n Hi! Welcome to program test_1") print(greatings) def program_delay(x, y): time.sleep(y) print(x) text_1 = ("\n «ATENTION» The program is ready to load") program_delay(text_1, 5) are_you_sure = ("\n Are you sure that you want the program to be loaded?") program_delay(are_you_sure, 4) yes_or_no = input("»( y / n ): ") yes = ("y") no = ("n") program_start = ("\n Loading Program ...") if yes_or_no == yes: program_delay(program_start, 1) def loading(x): for i in range(101): time.sleep(x) i = "»" + str(i) + "%" print(i) loading(0.5) print("\n") comands = input("root /project_1 /program test_1 >") print("\n") def simple_calculator(z, e): return e x = int(x) y = int(y) sum = x + y div = x / y sub = x - y mp = x * y if z == "sum": print(sum) elif z == "div": print(div) elif z == "mp": print(mp) elif z == "sub": print(sub) else: print("unknown comand, please try again") def calculator_extra(): x = input("Choose the fist number: ") y = input("Choose the second number: ") if comands == "smpl calc": loading(0) if comands == "smpl calc": z = input("Choose an operation type: ") if comands == "smpl calc": simple_calculator( z, calculator_extra()) else: print("Unknown process")

11th Feb 2018, 11:18 PM
►► Ferontwix ◄◄
►► Ferontwix ◄◄ - avatar
3 Respuestas
+ 3
first get rid of all delays after... step by step
11th Feb 2018, 11:53 PM
Oma Falk
Oma Falk - avatar
+ 2
yes... good job!
12th Feb 2018, 6:10 AM
Oma Falk
Oma Falk - avatar
0
Thanks, now it's working at 100%, even with the delays (I removed them and added them again after solving the problem)
12th Feb 2018, 12:29 AM
►► Ferontwix ◄◄
►► Ferontwix ◄◄ - avatar