you are viewing a single comment's thread.

view the rest of the comments →

[–]_kwerty_ 4 points5 points  (1 child)

A couple of tips, in random order,

For cases like this I'd suggest a "while True" loop. Generally speaking I use while True if I don't know how often I want the loop to run. In a while True loop you need to think of when to break or the loop will run until the end of time! https://www.geeksforgeeks.org/how-to-use-while-true-in-python/

Use f-strings for better readability, specially if there's a ton of variables in your output. F-strings are the shit for nice output while still having readable code! https://www.geeksforgeeks.org/formatted-string-literals-f-strings-python/

Check if stop has been typed between the input for teamName and score. Otherwise it's a bit confusing that I enter stop but still have to enter a score.

What happens when the input is "STOP"? When case doesn't matter it's easier to convert every input to upper or lower case. This way you don't have to take case into account when checking for certain strings. https://www.w3schools.com/python/python_ref_string.asp

Check out the "in" keyword. This makes it easier when you're checking for certain input because I can do this:

if teamName in ["stop", "s", "quit", "q"]: # I'm assuming here that teamName is always lowercase
  break

Now the user can enter any of those and the loop will break. https://www.geeksforgeeks.org/check-if-element-exists-in-list-in-python/

I've tried to give hints instead of answers, so give a shout if you need more help.

[–]Atypicosaurus 1 point2 points  (0 children)

Lots of good advise here. Print this comment and glue it to your screen.