Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Lab Exercises: 1. Write a python program which do the following 1.1. Creates one process, this process must ask the user to enter a

Python image text in transcribed
Lab Exercises: 1. Write a python program which do the following 1.1. Creates one process, this process must ask the user to enter a valid ip address. A valid IP address must be in the form of A.B.C.D, where A,B,C and D are numbers from 0-255. The numbers cannot be prefixed unless they are 0. 2. 2.1. Write a python program which do the following: Create two processes and one queue. 2.2. The first process must put commands into the queue. The commands are 2.2.1. id 2.2.2. whoami 2.2.3. pwd 2.2.4. Is 2.2.5.cat 2.3. The second process must get the elements from the queue and execute them using the os module. If the command is cat, then the script must ask the user for the file name to view its contents. 2.4. Note: Don't forget to use a proper lock to prevent any errors in the code 3. Using Pool() do the following: 3.1. The pool must have 2 processes, each process will pass two parameters to search function, these parameters must be the name of the file and a word to search for these two parameters must be entered by the user and must be different from the process to another. 3.2. The Search function must search for the word in the file and if the word is found then find out the number of occurrences for this word otherwise return that the word doesn't appear in the file. You need to verify that the file the user input is actually a file and it exists in the system 3.3

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

Database Technology And Management Computers And Information Processing Systems For Business

Authors: Robert C. Goldstein

1st Edition

0471887374, 978-0471887379

More Books

Students also viewed these Databases questions

Question

What are some of the possible scenes from our future?

Answered: 1 week ago