+ 1
how to loop a def function for 3 accounts
I was able to create my working function. Now I need to loop it and print each account. Next I need to compare them. My problem is not knowing how to loop the function and keep each variable. Please help me Loop.
8 Antworten
0
I think that the variables that you need in each iteration are going to have to be passed to your function as an argument.
otherwise you would have to loop inside the function rather than call it multiple times
+ 2
Could you share the code?
Let's see if I understood
You want to call the function more than once without losing the function's local variables?
+ 1
l = []
for i in range(3) :
l[i] = def_func()
# is this you mean ?
+ 1
Also I would like to change change the 1st print statement. Saying "account 1" iterating to "account 2", account 3
0
No idea how the code works or what it does, but here's a loop
¿This is useful?
https://code.sololearn.com/c04yxjWe6NOH/?ref=app
0
It as a program that takes def summary(months subscribed=m, adfree months subscribed = a, video on demand purchases = v)
I need to repeat this function for 3 different accounts with the local variables
- 1
yes I need the local variables