DEV Community

Cover image for Master Python Documentation - Part1: Using the Python Interpreter.
Horace FAYOMI
Horace FAYOMI

Posted on • Updated on

Master Python Documentation - Part1: Using the Python Interpreter.

This is the summary of the first part of a video series in which we will go through the Tutorial part of Python official documentation.

Reading the documentation of your programming language, framework, or library, won't make you a pro-coder overnight, but it will help you improve your understanding. It helps you discover the tips, tricks and caveats of the technology that tutorials, courses, or books do not necessarily provide.


Summary

In this part, the documentation introduces us to the python interpreter. It shows the different ways to invoke the python interpreter and how to invoke python modules and scripts. We have also seen how to pass and retrieve arguments using the sys built-in module.


Questions

Let's see if you can find the right answers to these questions.

1- What are the ways to exit the python interpreter presented in the documentation? (select all the answers that apply):

a. Ctrl-X
b. Ctrl-D
c. Ctrl-ESC
d. quit()

2- When no script and no arguments are given to the python prompt, what will be the output of the following code:

import sys
print(sys.argv[0])
Enter fullscreen mode Exit fullscreen mode

a. IndexError: list index out of range because sys.argv is empty
b. None
c. an empty string ""

3- Complete this sentence:

When -m module is used, sys.argv[0] is set to the ……….. :

a. name of the module file
b. full name of the located module
c. relative name of the module


Here is the link to the video: [https://youtu.be/fUvT0O76DyY]

Here is the link part of the documentation that we covered in the video: [https://docs.python.org/3/tutorial/interpreter.html#invoking-the-interpreter]

Top comments (0)