Python Forum

Full Version: bug
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Good (for the time being Big Grin )afternoon!

So i would like some help fixing this (probably) easy script - as my user suggests im a scripting nub... (was learning LUA)

kind regards,
ScriptingNub LOL

def add(num1, num2):
    return num1 + num2

def div(num1, num2):
     return num1 / num2
        
def tim(num1, num2):
    return num1 * num2

def subt(num1, num2):
    return num1 - num2




def main():
    validinput = False

    while validinput == False:
        
        try:
            num1 = int(input("what is the first number"))
            num2 = int(input("what is the second number"))
            operation = input("what is the sign")
            validinput = True
            return()



    if (operation == "+"):
        print("adding")
        print(add(num1, num2))
        
    elif (operation == "-"):
        print("subtracting")
        print(subt(num1, num2))
        
    elif (operation == "*"):
        print("multiplying")
        print(tim(num1, num2))
        
    elif (operation == "/"):
        print("dividing")
        print(div(num1, num2))
      
    elif():
        print("operation not understood!")

main()



(also if you have any suggestions please let me know :D)
It would be nice if you gave us a clue as to what doesn't work properly.
ok ill try getting some info :D

there is a supposed "unexpected error"
before the if statement - ill send a bit of code with it


        try:
            num1 = int(input("what is the first number"))
            num2 = int(input("what is the second number"))
            operation = input("what is the sign")
            validinput = True
            
        


    if (operation == "+"):    #supposedly it is infront of the "if"
        print("adding")
        print(add(num1, num2))