Why does PyCharm after running any code gives out the same result?

Question:

I have recently started learning programming in Python and I’m using PyCharm as a text reader, I was trying out a few simple codes which I was following from a tutorial, these are the codes that I’ve tried:

Print("Hello World")

and also a simple calculator code:

num1 = input("Enter a number")
num2 = input("Enter another number")
sum = num1 + num2

print(sum)

Instead of getting as a result "Hello World" or being asked what numbers I want to input,I just get the exact same thing:

C:PythonPython39python.exe "C:/Users/Roman Moraru/PycharmProjects/pythonProject/main.py"
Hi, PyCharm

Process finished with exit code 0

I don’t know why this "Hi, PyCharm" keeps being the result of the program, I’ve looked around and haven’t seen anybody with the same problem, so I’m kinda lost here.

Asked By: Roman Moraru

||

Answers:

Within PyCharm, you may just need to keep track of which script you are running in PyCharm. Right-click the script you want to run and choose run or debug. You can also search for ‘Hi, Pycharm’ in your code to find the script that is running with menu: edit: find: find in files.

Answered By: Hammurabi

I had the same problem, you just need to switch the configuration from ‘Main’ to ‘Current File’ in the right hand corner on top.

Answered By: M Fernanda Senn
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.