Beginner Question: OR operator Not Working?

74 Views Asked by At

Just started learning python and I have been doing pet projects. During this one I decided to use the OR operator. When I added it to one of my IF STATEMENTS it worked as intended but when I added it to the other 3 it only ran the first IF STATEMENT.


while True:
    
    operation = input("What order of operation would you like to use(Addition/A ,Subtraction/S ,Multiplication/M, Division/D)?")
    
    if operation == "Addition" or "a" :
        while True:
            Set_Number = int(input("Starting Number: "))
            counter = Set_Number
            print(counter)
            
            number = int(input("Add:"))
            add_count = number
            counter += add_count
            print(f"Your Answer is " + str(counter))
            
    if operation == "Multiplication" or "m" :
        while True: 
            Set_Number = int(input("Starting Number: "))
            counter = Set_Number
            print(counter)
            
            number = int(input("Multipled By:"))
            add_count = number
            counter = counter * add_count
            print(f"Your Answer is " + str(counter))
        
    if operation == "Division" or "d" :
        while True:
            Set_Number = int(input("Starting Number: "))
            counter = Set_Number
            print(counter)
            
            number = int(input("Divided By:"))
            add_count = number
            counter = counter/add_count
            print(f"Your Answer is " + str(counter))
                    
    if operation == "Subtraction" or "s" :
        while True:
            Set_Number = int(input("Starting Number: "))
            counter = Set_Number
            print(counter)
            
            number = int(input("Subtracted By:"))
            add_count = number
            counter = counter - add_count
            print(f"Your Answer is " + str(counter))

Result

What order of operation would you like to use(Addition/A ,Subtraction/S ,Multiplication/M, Division/D)?m
Starting Number: 8
8
Add:1
Your Answer is 9
Starting Number:

Don't know how to fix. Need Help.

0

There are 0 best solutions below