Question: Part 1 : This lab will have you create and call on functions. Functions are statements that perform a task. They are only executed when

Part 1:
This lab will have you create and call on functions. Functions are statements that perform a task. They are only executed when they are called upon in the Python program. They can be called once or many times depending what the program needs to do.
This program needs to collect 4 pieces of data. What is collected is completely up to you. It just needs to make sense. An example could be collecting name, phone number, email, and address. Each of the 4 items needs to be its own function. You must then call the functions and have the user enter the data. For added complexity, the code needs to ask the user if they are willing to share each item. The user should be able to give just a name, email, phone number, or submit all the data (hint: you can use If Statements or any other means). Lastly, the data needs to be displayed to the user as a professional readable format. None of the items can show up as undefined or similar, so find a creative way to show no information was entered for that item.
You can save your code as lab4.py and run it through the python3 command.
Materials:
Research resources (google, databases, Lynda.com)
Python Editor (Notepad, Notepad++, Visual Studio Code)
Procedure:
/40 marks
Create code that creates the appropriate variables required define the data you are collecting. Create the 4(or more if needed) functions so they can be called upon by your code. Create some additional code to ask the user if they want to enter each piece of information. If they agree, store their information to be recalled at the end of the code. Run that process for all 4(or more) functions you created and finally display the inputted data back to the user in a professional and readable format. Remember, you must create a placeholder for data not collected. Undefined or simular is considered unacceptable. For this lab we are focused on functions and data collection. We will not worry about data validation at this point (to prevent GIGO).
Your Code:
Copy and paste your code here.
Questions:
1. Why would functions be a benefit to a software writer? Provide an example of some code that would be best used as a function. (Dont write the code, just describe it.)/5 marks

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!