THIS IS THE REFERNCE FOR COPY:
Dictionary
a) Define a function createUser() with an arbitrary dictionary parameter.
This function returns a dictionary based upon input arguments.
b) Define a function printUser() with a parameter user which is a dictionary.
This function prints the contents of the dictionary user.
c) Create and print the user: John, age 43, job Programmer, Hobby Biking
d) Create and print the user: Sara, age 20, school QCC, major CSIS
ANSWER THIS QUESTION:
Modules
a) Create a file userFunctions.py:
1. Copy nameFormat(), createUser(), and printUser() from the problems above into the userFunctions.py file.
2. Modify nameFormat() to accept only two parameters first and last. Change last to an optional parameter. This
function should now return either first or last, first.
3. Define a function printUsers() which accepts a list parameter users. This function calls the printUser function
to print all user data.
b) Create a separate file, functionModule.py:
1. Import all functions from userFunctions.py.
2. In this file create a list users.
3. Use nameFormat() and createUser() to add dictionaries to the list users:
John smith, age 42, job Programmer, hobby Biking
tom cat, age 24, job Security Analyst
jerry mouse, age 25, job DevOps Engineer, hobby Running
sara, age 20, school QCC, major CSIS
4. Use the printUsers() function to print all list users.
Example Output
name: Smith, John
age: 42
job: Programmer
hobby: Biking
name: Cat, Tom
age: 24
job: Security Analyst
name: Mouse, Jerry
age: 25
job: DevOps Engineer
hobby: Running
name: Sara
age: 20
school: QCC
major: CSIS
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
- Write three functions for: mean, remove, display //include any standard libraries needed // - passes in an array along with the size of the array // - returns the mean of all values stored in the array double mean( const double array [ ], int arraySize); // - Passes in an array, the size of the array by reference, and the index of a value to be removed from the array. // - Removes the value at this index by shifting all of the values after this value up, keeping the same relative order of all values not removed. // - Refuces arraySize by 1. void remove (double array[], not &arraySize, int index); // - Passes in an array and the size of the array. // - outputs each value in the array separated by a comma and space, with mo comma, space or beeline at the end. void display (const double array[], int arraySize); const int ARR_CAP = 100; int main (int argc, char *argv[]){// verify file name provided on command line // open file and verify it opened // declare an array of doubles of…arrow_forwardPython code please help, indentation would be greatly appreciatedarrow_forwardq2arrow_forward
- # dates and times with lubridateinstall.packages("nycflights13") library(tidyverse)library(lubridate)library(nycflights13) Qustion: Create a function called date_quarter that accepts any vector of dates as its input and then returns the corresponding quarter for each date Examples: “2019-01-01” should return “Q1” “2011-05-23” should return “Q2” “1978-09-30” should return “Q3” Etc. Use the flight's data set from the nycflights13 package to test your function by creating a new column called quarter using mutate()arrow_forwardRewrite the determineAdmission Fee function using a dictionary data structure such that it produces the same output when the program is run. #Determine an admission fee based on age group. def main(): print("Enter the person's age group ", end=""") ageGroup=input("(child, minor, adult, or senior): " print("The admission fee is", determineAdmission Fe def determineAdmission Fee(ageGroup): if ageGroup == "child": return 0 elif ageGroup == "minor": return 5 # age 6 to 17, $5 elif ageGroup == "adult": return 10 # age 18 to 64, $10 elif ageGroup == "senior": return 8 # age >= 65, $8arrow_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