Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task 0 2 : Understanding the sys Module ( 2 0 points ) Write a Python script that uses the sys module to perform the

Task 02: Understanding the sys Module (20 points)
Write a Python script that uses the sys module to perform the following tasks:
In a main method:
a. Read and print the command-line arguments when the script is run.
b. Print the Python path (the directories where Python is looking for modules to
import).
c. Print the Python version.
d. Print the platform name.
The main() function must only run automatically if the module is being run directly, not
when imported.
Here is a screenshot of the expected behavior, testing all scenarios described above. Replicate
this functionality in your script, including the formatting and outputs of all messages. The
program must work for any arguments that the user provides after the name of the script.Command-line arguments:
./lab_h_task_02_sdevil.py
system
programming
in
Python
is
a
hoot!
Python path:
/home/eric/lab h
/usr/lib/python310.zip
/usr/lib/python3.10
/usr/lib/python3.10/lib-dynload
/usr/local/lib/python3.10/dist-packages
/usr/lib/python3/dist-packages
Python version: 3.10.6(main, May 292023,11:10:38)[GCC 11.3.0]
Platform name: linux
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions