r/PythonLearning • u/Im_the_mafia_ • Oct 11 '26
Help Request Trouble with printing
I’ve been having trouble with an assignment I’m doing and I’m not sure where I went wrong. The only error i’m getting is “‘str’ object is not callable” and i’m not sure if anything else here is wrong.
Edit: After messing around with the code a bit, turns out my code wasn’t the problem and my previous files weren’t printing. After restarting vscode, everything was fine again. Thank you everyone!
12
u/External-Audience716 Oct 11 '26
Well one thing, in step 3 you're using gibberish instead of step 2. That's not your problem but something ive noticed
4
u/Rscc10 Oct 11 '26
Aside from using gibberish in step3, I don't see an issue and even so, there's shouldn't be an error even if you're using gibberish instead of step2 there. Can you send the exact error message as well as what gibberish is
3
2
2
u/Taco-Jedi Oct 11 '26
The problem is most likely caused by an earlier attribution of a variable you called "print". If, somewhere in your code, you have something like "print = 'name' ", it will throw an error. To fix that, just rename that variable to something else. I also noticed another thing in your code that might be wrong: in step3, instead of doing "step3 = step2.lower()", you wrote "step3 = gibberish.lower()", therefore your first 2 steps become absolutely useless
1
u/fllthdcrb Oct 13 '26
To fix that, just rename that variable to something else.
To be exact, one would need to assign it to a different name, and then
del print. The original assignment shadows the built-in value. Thedelstatement removes the binding in the current environment, while leaving the built-in intact and once again accessible.
1
u/VirulentParable Oct 11 '26
Most coding courses teach you to always do print in this format:
print(f”stuff goes here”)
1
u/AlexMTBDude Oct 11 '26
> The only error i’m getting is “‘str’ object is not callable”
Sure, but on which line of your code are you getting this error? That's a vital piece of information if you want to find the bug.
1
1
u/XNo_Notes Oct 12 '26
You can do ctl+p and start typing python then look for clear cache and refresh window to restart python without having to close it all down.
1
u/fllthdcrb Oct 13 '26
BTW, I think maybe you could combine steps 4 and 5 by just directly replacing underscores with spaces. Unless, of course, getting experience with split() and join() is part of the assignment, which is not a bad thing.
0
u/Hercules__Morse Oct 12 '26
Maybe delete this post if you have solved the issue yourself? This post will not help anyone else in the future...
41
u/RNG_HatesMe Oct 11 '26 •
First rule NEVER post code as a picture! How do you expect someone to test it out? Retype everything, really? And half the time, if you have a typo or minor syntax error then a more experienced programmer will intuitively fix it without realizing it.
Repost as actual code. There's even "code" and "code block" syntax type on reddit to get it to line up: