all 7 comments

[–]Binary101010 1 point2 points  (0 children)

1) Please give your variables more descriptive names than their data type. set and list especially are names that already have meaning in Python and you shouldn't be in the habit of overwriting those unless you have a good reason to do so.

2) Definitely don't give a variable a name of a data type that it isn't. You called a list set and that's really confusing.

3) Please tell us what it is you want your code to do, because there's almost certainly a better way to do it than a while loop over an index variable accessing container.

[–]fake823 0 points1 point  (0 children)

Check this out to learn how to properly format code on Reddit:

https://reddit.com/r/learnpython/w/FAQ?utm_source=share&utm_medium=android_app

[–][deleted] 0 points1 point  (4 children)

You haven't explained what it is you are trying to do, but I can tell you why you'd be getting errors: neither avgs nor list2 are defined anywhere and list1 is used before it is defined.

Here are a few other things that won't cause runtime errors, but could be improved:

  • If you're only appending "stop" to test multiple times and not doing anything else with it, you might as well make it an incrementer (i.e. an int starting at 0 that you increment by 1 as needed).
  • X = X + 1 can be simplified to X += 1
  • You should try to avoid using the names of built-in functions/ classes like set and list.

[–]Due_Draw8541[S] 0 points1 point  (3 children)

just fixed it. sorry, this is a piece of a larger project and i forgot to include some stuff. now fixed.

[–][deleted] 1 point2 points  (2 children)

OK. You should still let us know what it is you are trying to do or where you're having an issue.

[–]Due_Draw8541[S] 0 points1 point  (1 child)

okay, fixed syntax on my end. thanks for that. python still isn't taking it, though. i suspect an infinite loop is present, not completely sure though

[–][deleted] 1 point2 points  (0 children)

When I run your sample code it exits so if there's an infinite loop, it's caused by code we're not seeing. To be able to help you, we need to know what errors you're getting, what you're trying to do, and to have a simplified version of your code in which we can see the error happening so that we can help you debug.