![]() |
|
[Python] Iterating indexes of global values - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Python] Iterating indexes of global values (/showthread.php?tid=6155125) |
Iterating indexes of global values - simmer - May 22, 2021 Code global xI need x to include something other than i (i+1) I need i to have an infinite number of iterations (probably sets) I need both of those to be comparable size wise RE: Iterating indexes of global values - Flash7475 - May 23, 2021 I'm not quite sure what your trying to accomplish with this or why you need a global scope variable when you don't have any functions. Your code also does not make sense because x and i are not defined with anything. If your looking for an infinite number of iterations I would use a "while(True)" statement. If your looking for something sort of similar to what you posted, maybe this is what your looking for? Code def main():RE: Iterating indexes of global values - simmer - May 26, 2021 Cool. Now I have a type error: Code p = [set(), set(set())]How do I reference the end of the list? (May 23, 2021 12:14 AM)Flash7475 Wrote: I'm not quite sure what your trying to accomplish with this or why you need a global scope variable when you don't have any functions. Your code also does not make sense because x and i are not defined with anything. If your looking for an infinite number of iterations I would use a "while(True)" The actual code (which is fire-walled by hack forums) Does in fact have functions The fact that the global variables are undefined confuses me... but it’s best to just stick to what the debugger is doing so I’m waiting for the NameError to pop up before I test that out and/or ask online. I figured out the problem above Use -1 to reference the end of a list |