Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sage program question
#3
The first step to solving your problem, is fixing your code so it will actually run. Line 35, for example, literally does nothing (parentheses are needed to call a function).
And please, just make two functions instead of nesting one inside of another. There are valid reasons to have functions within functions, but this is not one of them.
Likewise, there are valid reasons for a function to call itself, but this is not one of those times. A while loop is much better (for your mind to wrap around what's happening, in addition to the stack and memory management).
You also have "import random" at a random point, that should be the very first line of your file.

Once you've organized it a little better following these tips, your code will be much easier to add new things to. As it stands, it is like a descent into madness, the threads of your mind unraveling before us, in neat little lines leading into a dark abyss from which nothing escapes.
Reply


Messages In This Thread
Sage program question - by Doesnotcompute - Oct-21-2016, 09:45 AM
RE: Sage program question - by sparkz_alot - Oct-21-2016, 03:15 PM
RE: Sage program question - by nilamo - Oct-24-2016, 05:14 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Basic Coding Question: Exit Program Command? RockBlok 3 684 Nov-19-2023, 06:31 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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