python pls
Create function math_life()
this function takes one or more argument.
If this function called with no argument, raise typeError. The math_life() function returns to a function defined inside. this will take a one argument. For the second argument, it will calculate second function passed to math_life(). You should assume that the math_life() passed x functions, when it called the x times it will calculate the xth function passed to math_life() arguments when it called x+1 time it again calculate the 1st function passed to math_life() on it argument. it keeps cycling through x function passed as arguments to the math.life().
For example
hello = math_life((lambda x: x+2),(lambda x: x*3), lambda(x: x**3))
this will be execute hello(1) returns 3 then execute hello(3) returns 9 and then execute 9 will return 81.
For additional, determine how many times math_life() called and stores the number and output them.
A function that takes 2 arguments: a string, strText and a number, int number that prints strText intNumber times.
def print_string(strText,intNumber):
print "\n",strText * intNumber
def print_string(strText,intNumber):
print "\n",strText * intNumber
string = raw_input("Enter a string: ")
num = int(input("\nEnter a number: "))
print_string(string,num)
Get Answers For Free
Most questions answered within 1 hours.