+ Code + Text 1) Define a dictionary called empInfo containing the data in the table below. Hint: empinfo is a nested di

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

+ Code + Text 1) Define a dictionary called empInfo containing the data in the table below. Hint: empinfo is a nested di

Post by answerhappygod »

Code Text 1 Define A Dictionary Called Empinfo Containing The Data In The Table Below Hint Empinfo Is A Nested Di 1
Code Text 1 Define A Dictionary Called Empinfo Containing The Data In The Table Below Hint Empinfo Is A Nested Di 1 (62.48 KiB) Viewed 41 times
+ Code + Text 1) Define a dictionary called empInfo containing the data in the table below. Hint: empinfo is a nested dictionary. Department empID empName email salary 500 CS 580 1101 ahmad [email protected] 1102 yousef 2- [email protected] [email protected] [email protected] 450 SWE 2101 sara w 2102 ahmad x- 600 2) Define a function called createFile() that receives a dictionary and writes the data in the dictionary to a file called empInfo.txt. createFile() should convert the first letter of the employee's name to a capital letter (e.g., ahmad m will be converted to Ahmad M). So the above created dictionary should be saved as in the following format empinfo.txt x 1 Dept, Id, Name, email, salary 2 CS, 1101,Ahmad m,[email protected],500 3 CS,1102, Yousef z,[email protected],580 4 SHE, 2101, Sara w, [email protected],450 5 SME, 2102, Ahmad x,[email protected],600 3) Define a function called updateFile() that • Read a new entry which should include the department, empID, empName, email, and salary from the user in the following format: depe emplD-empName-email-salary (eg, CS-110-khaled [email protected]). . Converts the first letter of the employee name to a capital letter (e.g., ahmad m will be converted to Almad M). .Write the collected data to empInfo.txt. You should not loose the data stored in empInfo.txt previously 4) Define a function called readFromFile() that reads from empInfo.txt and prints the data as in the samplit espul Sample Output: Enter the employee info (dept-empID-empName-email-salary): CS-1103-khaled halsede.co.com 30 Employee Info: Dept Id Name email salary CS 1101 Ahmad m [email protected] 500 CS 1102 Yousef z [email protected] 580 SWE 2101 Sara w [email protected] 450 SWE 2102 [email protected] Ahmad x 600 CS 1103 Khaled e [email protected] 5) Call createFile() functio 6) Call updateFile() function. 7) Call readFromFile() fucntion. 630
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply