Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 5 Computer users' information ID's, user names, surnames, and roles are recorded as a list of strings, as follows serverInfo-id-0;role-admin username-joe;surname-naysmith. surname-suffi;username-sam:role-guest;id-421, id-33;surname-lee:username-mia:role-staff )

image text in transcribed

Exercise 5 Computer users' information ID's, user names, surnames, and roles are recorded as a list of strings, as follows serverInfo-"id-0;role-admin username-joe;surname-naysmith". "surname-suffi;username-sam:role-guest;id-421", "id-33;surname-lee:username-mia:role-staff" ) A "user database" is a dictionary of computer user records: the key will be an ID and the value another (nested) dictionary, which comprises the key/value pairs of the user's info. Write a function that takes server info as input and returns the corresponding "database", as per the db-10: { 'username': "joe", 'surname': "naysmith", 'role': "admin" ) 421:username: "sam", surname: "suffi", 'role': "guest"| ) example below. Hint: Use string functions such as split/partition/join, etc. as needed. 33username': "mia", 'surname': "lee", 'role': "staff, Perform a "database query" that retrieves and print all user names and surnames (all capitalized) as well as their roles Naysmith, Joe - admin Lee, Mia - staff Suffi, Sam - guest Repeat the above "query" but this time users should be printed in ascending order of IID. Note: write a Python program to do the above question, add comments to make the code clearer Exercise 5 Computer users' information ID's, user names, surnames, and roles are recorded as a list of strings, as follows serverInfo-"id-0;role-admin username-joe;surname-naysmith". "surname-suffi;username-sam:role-guest;id-421", "id-33;surname-lee:username-mia:role-staff" ) A "user database" is a dictionary of computer user records: the key will be an ID and the value another (nested) dictionary, which comprises the key/value pairs of the user's info. Write a function that takes server info as input and returns the corresponding "database", as per the db-10: { 'username': "joe", 'surname': "naysmith", 'role': "admin" ) 421:username: "sam", surname: "suffi", 'role': "guest"| ) example below. Hint: Use string functions such as split/partition/join, etc. as needed. 33username': "mia", 'surname': "lee", 'role': "staff, Perform a "database query" that retrieves and print all user names and surnames (all capitalized) as well as their roles Naysmith, Joe - admin Lee, Mia - staff Suffi, Sam - guest Repeat the above "query" but this time users should be printed in ascending order of IID. Note: write a Python program to do the above question, add comments to make the code clearer

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions