Struggled with this for hours as a beginner, the issue i had was when I tried this command:
where python
It showed me that there were two instances of python
C:\Users\%username%\AppData\Local\Programs\Python\Python313\python.exe
C:\Users\%username%\AppData\Local\Microsoft\WindowsApps\python.exe
So I went and deleted the first python instance through the windows delete program function, deleted python from PATH as per this guide: https://answers.microsoft.com/en-us/windows/forum/all/how-to-remove-python-from-path/727a29e4-ff66-499f-b282-50b631958cb8
And then deleted the second instance following these commands through the cmd:
cd C:\Users\%username%\AppData\Local\Microsoft\WindowsApps
del python.exe
del python3.exe
Then I went installed a new instance of python through the official website, installed pygame through:
pip install pygame
And everything worked.
Might be a simple solution but I struggled with this for hours, hope this helps at least someone.