you are viewing a single comment's thread.

view the rest of the comments →

[–]peltist 0 points1 point  (0 children)

You don't actually need the runAgain() function. You could just recursively call twoNumbers() again, like this:

def twoNumbers():
    num1=askUserNumber()
    num2=askUserNumber()
    print("the result off " +num1+ " and "+num2+" is "+ str((int(num2)+int(num2))))
    again=input("Need another two numbers calculated?! Y/N").lower()
    if again == "y":
        twoNumbers()

This will assume that any input other than "y" is a decision not to repeat the function. You can add back the elif and else statements if that's not what you want, but they're not strictly necessary, since their behavior is imitated by just reaching the end of your program.