0
def evaluate():
    a=2
    return a

print(evaluate())

Then im getting "unresolved reference" in the pycharm where the evaluate() in print function is underlined in red color.

cdarke
  • 37,606
  • 5
  • 69
  • 77
  • 2
    Your code is fine. It's hard to tell why your IDE thinks it isn't. – NPE May 16 '18 at 18:23
  • You need to add source directory, if `evaluate()` not in current directory. – Nishant Nawarkhede May 16 '18 at 18:23
  • It returns 2 on my machine. Your code has no problem at all. – Ninja Warrior 11 May 16 '18 at 18:23
  • Possible duplicate of [Unresolved reference issue in PyCharm](https://stackoverflow.com/questions/21236824/unresolved-reference-issue-in-pycharm) – Ninja Warrior 11 May 16 '18 at 18:25
  • I'm running PyCharm 2018.1.1 on Ubuntu... There are no errors from this code. After I fix your PEP8 problems, there are no warnings either (spaces around the assignment operator, double line between the function and print). /usr/test/venv/bin/python /usr/pycharm-2018.1.1/helpers/pydev/pydevd.py --multiproc --qt-support=auto --client 127.0.0.1 --port 39627 --file /usr/test/blah.py pydev debugger: process 37851 is connecting Connected to pydev debugger (build 181.4445.76) 2 Process finished with exit code 0 – sehafoc May 16 '18 at 18:29

0 Answers0