Nov-24-2020, 10:42 PM
I wrote a calculator but it doesn't count
I have to use the logging library but i don't know how. Previously, everything worked without this library, now the program does not count. Please help me in indicating how and where to insert logging

# Task calc # Add def add(x, y, *args): return x + y # Sub def subtract(x, y, *args): return x - y # Miltiply def multiply(x, y, *args): return x * y # Divide def divide(x, y, *args): return x / y def get_data(): choice = input("Choose action(1/2/3/4): ") x = float(input("enter number 1: ")) y = float(input("enter number 2: ")) args = [] if choice in "13": while True: num = input("enter anotehr number or q to quit: ") if num == 'q': break args.append(float(num)) return x, y, args, choice print("Enter the action using the appropriate number:") print("1.Add") print("2.Substract") print("3.Multiply") print("4.Divide") operations = { '1': add, '2': subtract, '3': multiply, '4': divide, } x, y, args, choice = get_data() result = operations[choice](x, y, *args)After choosing for example first option, addition, i can enter two number but after this, program doesnt count:
Enter the action using the appropriate number: 1.Add 2.Substract 3.Multiply 4.Divide Choose action(1/2/3/4): 1 enter number 1: 5 enter number 2: 5 enter another number or q to quit: q