0

No output ? Why

x=5 if x==6: print =('nom is six') else: if x==5: print =('nom is five')

9th Nov 2016, 1:49 PM
Sherif Radwan
Sherif Radwan - avatar
3 ответов
+ 4
You are reassigning the keyword "print" as a string function...sortof. Basically you're breaking the interpreter. Attempting to use print after this reports the Exception: TypeError : 'str' object is not callable Explanation (you are responsible for your code): http://stackoverflow.com/a/31865529/3981745 Remove the = sign on the print statements. You might have to restart your interpreter.
9th Nov 2016, 4:15 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
@Fronz-Tec That's not what's happening. Try the OP's code in your interpreter then try print(). It's broken.
9th Nov 2016, 4:20 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
I'm leaving a downvote on my response to Fronz-Tec. I downvoted their answer (that's now missing, which recommended removing x==5) because it appeared to upvote immediately after I responded. I try not to delete my answers unless they're distracting. It's okay to get the cause wrong; hiding that can delay learning. Similarly it's okay to leave what looked like a parting shot, which may just be someone who disagrees with in-thread discussion, etc.
9th Nov 2016, 4:39 PM
Kirk Schafer
Kirk Schafer - avatar