Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (16.4k points)

In the Python Command line, To exit from the cmd line, I need to type exit(). But when I type exit, it says

Use exit() or Ctrl-Z plus Return to exit

I don't know why I'm getting this error. Why doesn't it exit? 

1 Answer

0 votes
by (26.4k points)
edited by

If you look at the python interpreter, exit is a string, not a function. 

In python what's going on is that exit is a function. On the off chance that you don't call the function, it will print out the string representation of the obj. This is the default conduct for any object returned. It's simply that the originator's figured individuals may attempt to type exit to exit the interpreter, so they made the string representation of the exit work a supportive message. You can check this conduct by typing str(exit) or even print exit.

Interested to learn Python? Come and Join: Python online course

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
2 answers
0 votes
1 answer
0 votes
1 answer

Browse Categories

...