Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Help
#3
If you can't use loops, you can use recursion. Since it should only recurse 3 times, there won't be a stack overflow problem. Here's an example of recursion:

def recurse(x):
    print(x)
    if x > 0:
        recurse(x - 1)

recurse(4)
That will output this:
Output:
4 3 2 1
Reply


Messages In This Thread
Python Help - by acac0606 - Jan-23-2020, 03:46 AM
RE: Python Help - by michael1789 - Jan-23-2020, 04:48 AM
RE: Python Help - by stullis - Jan-24-2020, 03:26 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020