search

Home  >  Q&A  >  body text

I don’t understand the little turtle’s after-school exercises, why does a bug appear?

In the example, the little turtle has a variable named str, but in fact we found that the color of str seems to be different from that of ordinary variables? Yes, str() and print() are both built-in functions, but Python doesn’t seem to mind us assigning values ​​to built-in functions, so we must pay attention to this in the future, otherwise the following BUG may occur:>> > print = 1>>> print("I love FishC")Traceback (most recent call last): File "<pyshell#37>", line 1, in <module> print("I love FishC ")TypeError: 'int' object is not callable

笙洺笙洺1647 days ago1297

reply all(0)I'll reply

No reply
  • Cancelreply