0
Python How to write a function with n as argument, If n=1 it prints f(x),If n=2 it prints f(f(x)), If n=3 it prints f(f(f(x)))?
3 Antworten
+ 4
They probably want you to write two functions or have part of the code in global. One function (or the code in global) would just call the other function like this:
...
for i in range(n) :
x = f(x)
...
+ 2
Do you only want to print "f(f(...f(f(f(x)))...))"?
Did you mean you wanted to call these functions?
For first problem I'd only use loops and string handling, but for second problem I'd use recursion:
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2465/
0
They want me to write a function with f and n as arguments