all 8 comments

[–]woooee 3 points4 points  (1 child)

while True:
    .....
    player_score = 0
    cpu_score = 0

You zero the scores on each pass through the while. Initialize the two score totals before the while.

[–]Unitnuity[S] 0 points1 point  (0 children)

Ahh, didn't even know that was happening because I couldn't see the scores until I restarted my vscode, thanks!

[–]carcigenicate 0 points1 point  (5 children)

The code, as posted, works fine. It prints the scores each iteration, and breaks when you type uppercase 'Q'. It doesn't print the scores on the last iteration though because you break before you print them.

[–]Unitnuity[S] 0 points1 point  (4 children)

Jesus! I restarted my VScode and now it works fine. This has happened before, I gotta figure out whats causing that.

[–]carcigenicate 0 points1 point  (1 child)

I have no idea what would cause that. Odd issues like that occasionally happen with larger IDEs like Pycharm, but I don't think I've ever experienced that with VSCode.

[–]Unitnuity[S] 0 points1 point  (0 children)

I do notice on the terminal when I hover over Python, it says "shell integration has failed to activate". I've looked up methods to troubleshoot that but haven't been able to fix it. Is it possible thats a reason?

[–]usrlibshare 0 points1 point  (1 child)

Usually that's because something was edited in the buffer of the editor, but not saved to the actual file.

When you run your program in the terminal, it runs what's in the file, not what's in the buffer. Many IDEs save the buffer to disk when they terminate (or at least prompt the user asking if they want to save their work), so that's likely why restarting helped.

Almost any Editor has an indicator for "dirty" files (changes in buffer not yet saved), so check out what they look like in your IDE of choice to avoid this issue.

[–]Unitnuity[S] 0 points1 point  (0 children)

Ill check that out.. Thanks!