Usually, the first line of a Python program is a special comment indicating which version of Python you’re using. What should this comment look like?
A. # Python 3.8
B. #!/usr/bin/env python
C. // Python 3.8
D.
Usually, the first line of a Python program is a special comment indicating which version of Python you’re using. What should this comment look like?
A. # Python 3.8
B. #!/usr/bin/env python
C. // Python 3.8
D.
The correct answer is B. #!/usr/bin/env python.
This line is called a “shebang” and it indicates which interpreter should be used to execute the script. It enables the script to be run in environments where the Python interpreter is located in different paths. Option A is just a comment and does not instruct the system on how to execute the file, while option C uses the wrong comment syntax for Python. Good luck with your studies!