Question: Python. make a function called recu_tup. This function returns tuples. This tuple contains the name and number. You should write a function recursively, which no
Python.
make a function called recu_tup. This function returns tuples. This tuple contains the name and number. You should write a function recursively, which no for loop allowed!
def recu_tup(ex_tup,name,num)
#If ex_tup don't have the same name, then you should add a new tuple (name, num) in the ex_tup
#If ex_tup has the same name, then you should change the num of the name. For example ("hello",2) change to ("hello",5) "
Example output
example = (("A",3),("B",4),("C",5),("D",6))
print(recu_tup(example,"E",5))
output = (("A",3),("B",4),("C",5),("D",6),("E",5))
print(recu_tup(example,"D",2))
example = (("A",3),("B",4),("C",5),("D",2))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
