subject

4.23 lab: structured phonebook while playing around with his new phone, kenneth found out that it can store more information about his friends than only their phone numbers. after adding some more information to it, he ended up with the following phonebook: name phone biggest fear maegan 1 major neuroscience caio grading comp. sci. bruce 3 bats however, after he was done he couldn't remember how to retrieve this information and needs your ! to achieve this, you need to: • create a dictionary with all the information above;
• prompt the user for the name of a friend • if the name is not one of kenneth's friends, print an error out. for instance, if name==clark, you should print: no friend named clark.
• next, take as input the piece of information the user wants, only if the name is of one of his friends;
• if the required information exists for the given friend, print it out. for instance, if name==maegan and information==phone, you should print: maegan's phone is 1.
• else, if the information does not exist, print an error out. for instance, if name==bruce and information==major, you should print: no major for bruce. hint: use a dictionary of dictionaries -> data['maegan']['major'] == 'neuroscience'.
hint: to print out a single quote you can do either print(" ") or print(' \ ').

example 1 (friend is listed and information exists): if the input is: caio biggest fear the output should be: caio's biggest fear is grading.
example 2 (friend is listed but information doesn't exist): if the input is: bruce nickname the output should be: no nickname for bruce.
example 3 (friend isn't listed): if the input is: clark kent the output should be: no friend named clark kent.

important: notice that we do not have a second input if the friend isn't known! lab activity 4.23.1: lab: structured phonebook 0/30 main. py

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:40
1. the program must provide following functions to extract some statistics. note that the data_list parameter specified in these functions may be the same for all functions or different for different functions—that is your choice. a skeleton file is provided on mirmir. a) open_file()prompts the user to enter a year number for the data file. the program will check whether the year is between 1990 and 2015 (both inclusive). if year number is valid, the program will try to open data file with file name ‘year.txt’, where is the year. appropriate error message should be shown if the data file cannot be opened or if the year number is invalid. this function will loop until it receives proper input and successfully opens the file. it returns a file pointer and year. i. hint: use string concatenation to construct the file name b) read_file(fp)has one parameter, a file pointer read. this function returns a list of your choosing containing data you need for other parts of this project. c) find_average(data_list) takes a list of data (of some organization of your choosing) and returns the average salary. the function does not print anything. hints: i. this is not the average of the last column of data. it is not mathematically valid to find an average by finding the average of averages—for example, in this case there are many more in the lowest category than in the highest category. ii. how many wage earners are considered in finding the average (denominator)
Answers: 1
question
Computers and Technology, 22.06.2019 22:20
Pp 4.1 design and implement a class called sphere that contains instance data that represents the sphere’s diameter. define the sphere constructor to accept and initialize the diameter and include getter and setter methods for the diameter. include methods that calculate and return the volume and surface area of the sphere (see pp 3.5 for the formulas). include a tostring method that returns a one-line description of the sphere. create a driver class called multisphere, whose main method instantiates and updates several sphere objects.
Answers: 1
question
Computers and Technology, 23.06.2019 10:00
What is estimated time of arrival (eta)? a device that measures the acceleration (the rate of change of velocity) of an item and is used to track truck speeds or taxi cab speeds a gps technology adventure game that posts the longitude and latitude location for an item on the internet for users to find a north/south measurement of position the time of day of an expected arrival at a certain destination and is typically used for navigation applications
Answers: 3
question
Computers and Technology, 23.06.2019 18:30
Write a program that prints the day number of the year, given the date in the form month-day-year. for example, if the input is 1-1-2006, the day number is 1; if the input is 12-25-2006, the day number is 359. the program should check for a leap year. a year is a leap year if it is divisible by 4, but not divisible by 100. for example, 1992 and 2008 are divisible by 4, but not by 100. a year that is divisible by 100 is a leap year if it is also divisible by 400. for example, 1600 and 2000 are divisible by 400. however, 1800 is not a leap year because 1800 is not divisible by 400.
Answers: 3
You know the right answer?
4.23 lab: structured phonebook while playing around with his new phone, kenneth found out that it c...
Questions
Questions on the website: 13722363