This Assessment is divided into 3 parts with multiple file submissions. Please read all directions, including submission directions for each part, and submit as directed.PurposeFor this assessment in...

1 answer below »



This Assessment is divided into 3 parts with multiple file submissions. Please read all directions, including submission directions for each part, and submit as directed.



Purpose



For this assessment in Part 1, you will explore the sys, os, and subprocess modules in Python. You will execute a variety of basic functions in these modules that interface with the operating system. While the functions in these modules can be used in a program, for this assessment, you will take the opportunity to execute these commands directly in the Python shell.



In Part 2, you research and reflect on the role of programming in understanding patterns of human behavior. There are many tools in the Python programming language that make processing large volumes of data easier so that patterns can be detected to make better business decisions.



In Part 3, you understand and demonstrate the role of user-defined modules in Python. A Python module is a file that contains one or more function definitions or classes. Modules play a vital role in making more reusable code that can be shared between projects or with other programmers. A module you create is just like any other module in the Python standard library.



Module 3 Assessment Part 1



Requirements-Part 1



Using the Python shell, execute the following functions. You will take screenshots at key points to show the successful execution. These will be placed in a single Word document. Recommended screenshot points are listed within the assigned functions, but you may add screenshots if necessary, to show the successful completion of the assessment.

(Hint: Under Windows, some of these functions will accept a single backslash in a file path, while others require double backslash between folders.)



Instructions—Part 1



1. In the Python shell, first import the sys, os, and subprocess modules.



Refer to the following Python documentation for more on importing modules: Python Software Foundation.



2. Execute os.getlogin()



Refer to


Python Software Foundation.



3. Execute os.get_exec_path()



Refer to Python Software Foundation.



4.

Take a screenshot.



5. Execute sys.path



Refer to


Python Software Foundation.



6. Execute sys.byteorder



Refer to


Python Software Foundation.



7.

Take a screenshot.



8. Execute os.listdir on your C: drive



Refer to Python Software Foundation.



9. Use os.mkdir to make a new folder on your C: drive named tempPython



Refer to Python Software Foundation.



10.

Take a screenshot.



11. Use subprocess.Popen to execute the Windows dir command and have its output placed in a text file named pythonOut.txt

Hint: The argument for Popen in this case will be ('C:\\windows\\system32\\cmd.exe "/c dir C:\\ >> C:\\pythonOut.txt"')



Refer to Python Software Foundation.



12. Open pythonOut.txt in Notepad and position that window next to the Python shell window where both can be seen.



13.

Take a screenshot.



14. Use subprocess.Popen to open Windows calc.exe utility



Refer to Python Software Foundation.



15.

Take a screenshot.



Module 3 Assessment Part 2



Research the following and write a 2- to 3-page double-spaced paper (not including the title and reference pages) addressing the following:





  • Define big data.





Reference

Introducing Data Science: Big Data, Machine Learning, and More, Using Python Tools
, Chapter 1: Data Science in a Big Data World, or other scholarly resource.





  • Discuss the role of languages like Python in the analysis of big data, such as, but not limited to, a grocery store database of purchases.





  • How can software determine patterns of human behavior from this data?





  • How does this information affect business decisions?





  • What tools are available in Python to analyze data? List at least three.





Reference

Introducing Data Science: Big Data, Machine Learning, and More, Using Python Tools,

Chapter 3: Machine Learning / 3.1.3 Python Tools Used in Machine Learning; Python.org documentation; or other resources.





  • Select one specific tool and examine a hypothetical scenario where it would be used in analyzing data to determine a pattern.






    • Describe the tool and share a documentation resource.





    • Describe the hypothetical scenario where this tool could be used.





    • Address how this tool would help in analyzing data to determine patterns.






Viewpoint and purpose should be clearly established and sustained, and the paper should be well-ordered, logical, and unified, as well as original and insightful.



Assessment should follow the conventions of Standard English (correct spelling, grammar, and punctuation) and be in APA format with separate title and reference pages formatted per APA guidelines.



Requirements—Part 2:



For more information on APA style formatting, go to Academic Writer, formerly APA Style Central, under the Academic Tools area of this course.



.



Module 3 Assessment Part 3



Requirements—Part 3:



You will write a program that demonstrates the use of user-defined modules by invoking functions from imported modules. Your program will accept a distance value and unit of length (miles or kilometers) and will call functions within your user-defined modules to convert the distance to the other unit of length. You will create two modules that contain the functions: one to convert miles to kilometers and one to convert kilometers to miles. Your program should continue converting entered distances until the user chooses to discontinue the program.



Instructions—Part 3



1. You will begin by creating the modules that hold the conversion functions. Start a new Python file and build each function to do the appropriate conversions.





  1. Create a module named miles.





  2. Create a function within this module named convertToMiles that accepts one value and returns the converted value when called.





  3. Create a second module named kilometers.





  4. Create a function within this module named convertToKilometers that accepts one value and returns the converted value when called.





Conversion formulas for your reference:



Metric Conversions (Kilometers-to-miles)



Metric Conversions (Miles-to-kilometers)



Hint: Modules are created as Python files with the same .py file extension as your main program file. Your modules must be within the same folder/directory as your program file in order to invoke functions from them.



Reference: Refer back to

Learn to Program With Python 3: A Step-by-Step Guide to Programming
, 2
nd

edition, Chapter 4: Definition of a Function; and

Programming in Python

Chapter 7: Python Modules / 7.2 Module Definition /



7.3 Creating a Module.



2. Next you will create your Python program to accept user input of a distance value and unit of length (miles or kilometers). You will start by including the import statements at the top of this program. You will import both the miles and kilometers modules you just created.



Reminder: These three Python files must exist within the same directory.



Reference: Refer to

Programming in Python

Chapter 7: Python Modules / 7.2 7.5 7.6 Importing Modules.



3. Initialize variables. You should create two flag variables and initialize them to a value of true: one for when an invalid value is entered and one for when the user chooses to stop the processing (i.e., validValue, processing).



4. Create a conditional loop that will continue the processing until the user chooses to exit.



Hint: Use the processing flag you just created in step 3 as your test condition.



Reference: Refer back to

Learn to Program With Python 3: A Step-by-Step Guide to Programming
, 2
nd

edition, Chapter 6: Loops / The While Statement.



5. Accept a distance value and unit of length from the user and store these two values in variables. Use prompts such as:



Please enter a distance value:



What is the unit of length (M = miles, KM = kilometers):



Hint: Preface your input statement with float to ensure the value they enter is stored as a decimal number for use in the conversion formulas.



Reference: Refer back to your readings in

Learn to Program With Python 3: A Step-by-Step Guide to Programming
, 2
nd

edition, Chapter 3: Built-In Functions / Getting Input From the User.



6. Incorporate a decision structure to check the unit of length entered by the user and call the appropriate conversion function from your user-defined modules.





  1. If the user entered “M”, call the convertToKilometers function passing in the user entered distance. Store the result of the function call in a new variable (convertedDistance).





  2. If the user entered “KM”, call the convertToMiles function passing in the user entered distance. Store the result of the function call in a new variable (convertedDistance).





  3. Use an else statement for any other values and set the validValue flag to false to indicate an invalid value was entered.





Hint: Use the string function, upper, to convert the user input to uppercase and check for a value of M or KM only.



Reference: Refer back to

Learn to Program With Python 3: A Step-by-Step Guide to Programming
, 2
nd

edition, Chapter 5: The if Statement / Comparison Operators /



The elif Statement.



7. If the user entered a valid unit of length, display the distance they entered, the unit of measurement and the converted distance/unit. Otherwise, display an error message. (i.e. Your distance of 26.2 miles is equivalent to 42.1 kilometers or You entered an invalid unit of length.)



Hint: Use an IF/ELSE decision structure here. Concatenate the results into one string.



Reference: Refer back to your readings in

Learn to Program With Python 3: A Step-by-Step Guide to Programming
, 2
nd

edition, Chapter 2: Print Statements; Chapter 3: Built-In Functions / Concatenation

;

Chapter 5: The if Statement.



8. Add another prompt to ask the user if they would like to continue. (i.e., Press X to quit or enter to continue processing.)



9. If the user entered a value to discontinue processing, set the processing flag to false to conclude the conditional looping and end the program.



Note: These small programming examples include very minimal data validation. Feel free to expand upon this and add additional layers of validation.



Example Output



Please enter a distance value: 26.2



What is the unit of length (M = miles, KM = kilometers) : m



Your distance of 26.2 miles is equivalent to 42.16 kilometers



Press X to quit or enter to continue processing.



Please enter a distance value: 5



What is the unit of length (M = miles, KM = kilometers) : km



Your distance of 5.0 kilometers is equivalent to 3.10 miles



Press X to quit or enter to continue processing. X



End processing of distances.




Answered 2 days AfterOct 09, 2022

Answer To: This Assessment is divided into 3 parts with multiple file submissions. Please read all directions,...

Jahir Abbas answered on Oct 09 2022
56 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here