Write a Python script that uses the sys module to perform the following tasks:
1. 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.
2. 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.
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images
- You are required to write a C program on Unix/Linux in which the parent process creates three child processes, lets them run concurrently, and waits for them to return and prints their exit status. The three child processes are assigned different tasks. Child one is to calculate and display the average mark of a class of twenty students for a unit. Child one is required to get the marks from the standard input (i.e. the keyboard). Child two is to load a program called “wc” (word count) to count file1. Child two is required to get file1 by the command line argument. Child three is to modify file2 by first inserting “this is the updated version.” at the beginning of this file and then replacing all the occurrences of the word “run” by “execute” and “examine” by “study”. You are required to write your OWN program for the file update. Child three is required to get file2 by the command line argument.arrow_forwardI ran the code and this is the error I got? Please fix the code and make sure the code compiles propertly. I really need to get full points on this.arrow_forward______ lets you think about the big picture without worry about the details in Python. A. Appending B. Arguments C. Authoring D. Abstraction Which one is correct?arrow_forward
- Question 1 Please provide all steps and explain. Consider the expression (a + b) * c, but with string values for a, b, and c. Enter that into the Python shell. What happens? Why? Full explainthe this question very fast solution sent me step by step Don't ignore any part all part work u Text typing work only not allow paper workarrow_forwardWrite a C/C++ program that performs the tasks described below. The program should fork one process. Have the new process execve theprogram named /bin/sed. Use dup2 (or dup) with a pipe to establish a wayfor the original process to capture stdout from sed. The program willaccept command-line arguments that it passes along to sed via execve.Any valid sed arguments may be used during testing.Sample executions are given below. Be sure to have this: alarm(90); as the first executable line in *BOTH* processes, which means you willneed to do it in at least one of the processes after the fork. Tests will be done by typing commands like this: ./p4 's/p/Z/g' TEMPIN The original process should capture stdout from sed and then print EACH lineprefixed by: SED:For correctness, it is important that EACH line have the prefix. For example, suppose that TEMPIN contains these lines: harry potter powerful wizard hermione played chess snape taught many pupils If the program is run as…arrow_forwardCreate a java class to represent a log message. The log message should include the following attributes:a. The severity of the message from least to most severe: DEBUG, INFO, WARNING, ERROR, or CRITICAL.b. The name of the module that has created the log.c. The timestamp at which the log was created in the format“YYYY/MM/dd HH:mm:ss.SSS” (see java.text.SimpleDateFormat).d. The message to be logged.e. A toString() method that returns a string in the format:[severity][timestamp][name] messagearrow_forward
- For the following problem, please do not provide me any code. I will give you my code please check it and make corrections as necessary. Write a c program that will generate the safe sequence of process execution for the situationgiven below:(Use Banker’s Algorithm).Note: The code can be implemented in several different ways, but make sure the parameterremains the same as shown below.n = 6; // Number of processesm = 4; // Number of resourcesint alloc[6][4] = { { 0, 1, 0, 3 }, // P0// Allocation Matrix{ 2, 0, 0, 3 }, // P1{ 3, 0, 2, 0 }, // P2{ 2, 1, 1, 5 }, // P3{ 0, 0, 2, 2 }, // P4{1, 2 , 3, 1 } }; //P5int max[6][4] = { { 6, 4, 3, 4 }, // P0 // MAX Matrix{ 3, 2, 2, 4 }, // P1{ 9, 1, 2, 6 }, // P2{ 2, 2, 2, 8 }, // P3{ 4, 3, 3, 7 }, // P4{ 6, 2 , 6, 5 } }; //P5int avail[4] = { 2, 2, 2, 1 }; //Available resources My Code for the above problem: #include <stdio.h> int main() { int n, m; n = 6; // Number of processes m = 4; // Number of resources //…arrow_forwardDemonstrate an understanding of basic C++ programming concepts by completing the following: Program: Create a simple C++ console application that will write a program that will take two string inputs from a user. Your program should concatenate the two strings and then print the resulting output to the screen. Take the two string inputs from the user 3 times for varying string lengths. Program Analysis: Given your program implementation, discuss and identify the possible vulnerabilities that may exist. If present, discuss solutions to minimize the vulnerabilities. Then discuss and identify possible problems that can result in errors for string manipulation of data. Your program analysis should be 1-2 pages in length.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education