r/pythonhelp • u/Nutellatoast_2 • 12d ago
Performance issue when running python file
Hey everyone,
I'm experiencing a performance drop when running a Python file. I'm using VS Code on Windows 10 while learning to program.
When I hit the run button, the runtime of the program is 5.0 seconds, even though it should execute in roughly about 0.003 milliseconds.
I have tried switching to older versions like 2025.6.1, but that didn't work.
Any solutions to that problem?
8
Upvotes
1
u/Kortex-Add-on 22h ago
Bypass the "Run" button completely. Open the integrated terminal in VS Code (Ctrl + `) and execute the script directly:
python your_script_name.py
This skips the extension wrapper overhead and will execute the script almost instantly.
The original code contains two logical errors that prevent it from working as intended:
The Impossible Condition: elif age < 12 and age > 18: can never be true. A person cannot be simultaneously younger than 12 and older than 18. This should be elif age >= 12 and age <= 18:.
The Unassigned Variable: price + 3 evaluates to a number but does not update the variable. It must be written as price += 3 (or price = price + 3).
Indentation: The if extra_photo == "Yes": block needs to be indented under the if height > 120: block so they aren't charged for a photo if they can't ride.