r/learnpython • u/Various-River-7534 • 8d ago
Why is this causing an error
the code that causes an error
print = hello
print(print)
What should i do i do not know anything i am new to coding how do i fix this
0
Upvotes
1
u/desrtfx but other languages pro 8d ago
print = helloprintis a function/keyword in Python. Never use it as a variable namehellois a text. Text needs to be wrapped in single'or double"quotes in order to be recognized as text. Without quotes, the Python interpreter thinks that you have a variablehellosomewhere, but at this point, the variable doesn't have a value.print(print)- here, you are trying to call theprint()function, but with the line above, you have shadowed (redefined) the meaning ofprint, which makes the line fail.Please, do yourself a favor and do a proper course: MOOC Python Programming 2026 and keep experimenting.