Changing the setting in the code runner extension can solve the issue. Following these steps could work for you:
- Open the settings tab beside your code runner extension
- Go to Code Runner: Executor map
- Click on settings.json below it.
enter image description here
- The existing python should be "python": "python -u". Change it to "python":"python3"
VSCode Setting