Defining a function in python -
so don't see did wrong feel if def x():.
def add(): numberadd_a = input("enter value a:") numberadd_b = input("enter value b:") numberadd_a = int(numberadd_a) numberadd_b = int(numberadd_b) sumadd = int(numberadd_a) + int(numberadd_b) print("sum:", sumadd) return add()
this infinite recursion. calling add
function @ end of add
function.
def add(): numberadd_a = input("enter value a:") numberadd_b = input("enter value b:") numberadd_a = int(numberadd_a) numberadd_b = int(numberadd_b) sumadd = int(numberadd_a) + int(numberadd_b) print("sum:", sumadd) return add() # here
use this:
def add(): numberadd_a = input("enter value a:") numberadd_b = input("enter value b:") numberadd_a = int(numberadd_a) numberadd_b = int(numberadd_b) sumadd = int(numberadd_a) + int(numberadd_b) print("sum:", sumadd) return sumadd # replaced add() # call function
Comments
Post a Comment