Write a program that keeps names and emails addresses in a dictionary as key-value pairs. First print all keys with their value using for loop.then the program should display a menu that lets user look up a person’s email address, add a new name and email address, change an existing email address and delete an existing name and email address

Answers

Answer 1

The program keeps names and email addresses in a dictionary as key-value pairs, as written below.

What are codes?

Codes are the language that is used to write programs.

f=open('email.dat','rb')

  d=pickle.load(f)

  f.close()

except:  

  d={}

while True:

  print('\n1. Find a email address')

  print('2. Add name and email address')

  print('3. Change an email address')

  print('4. Delete an email address')

  print('5. Exit\n')

  choice=input('\nEnter a choice: ')

  if choice:

      choice=int(choice)

  else:

      print('\nEnter a number')

      continue  

  if choice == 1:

      while True:

          name=input('\nEnter the name ')

          if name:

              if name in d:

                  print('\n%s is the email id of %s \n' % (d[name],name))

                  break

              else:

                  print('\n Email not found \n')

                  break

          else:

              print('\nName cannot be empty\n')

              continue

  elif choice==2:

      while True:          

          name=input('\nEnter the name ')

          if name:

              break;

else:

              print('\nName cannot be empty \n')

              continue

      while True:          

email=input('\nEnter the email address ')

          if email:

              d[name]=email

              break

          else:

              print('\nEmail cannot be empty\n')

              continue

        elif choice==3:

      while True:          

          name=input('\nEnter the name to change the email address ')

          if name:

              if name in d:

                  email=input('\nEnter the new email address ')

                  d[name]=email

                  print('\nEmail address changed \n')

                  break;

              else:

                  print('\nName not found \n')

                 break

          else:

              print('\nName cannot be empty \n')

              continue

  elif choice == 4:

      while True:          

          name=input('\nEnter the name to remove ')

          if name:

              if name in d:

                  del d[name]

                  print('\nName and Email address removed \n ')

break;

              else:

                  print('\nName not found \n')

                  break

          else:

              print('\nName cannot be empty\n')

continue

  elif choice == 5:

      f=open('email.dat','wb')

      pickle.dump(d,f)

      f.close()

      sys.exit()

  else:

      print('\nEnter a valid choice ')

Therefore, the codes are written above.

To learn more about codes, refer to the link:

https://brainly.com/question/28848004

#SPJ5


Related Questions

What are limitations of AI

Answers

Explanation:

Limitations of artificial intelligence. One of the main barriers to implementing AI is the availability of data. Data is often siloed or inconsistent and of poor quality, all of which presents challenges for businesses looking to create value from AI at scale.

Answer:

Risks and limitations of artificial intelligence in business

Businesses are increasingly looking for ways to put artificial intelligence (AI) technologies to work to improve their productivity, profitability and business results.

However, while there are many business benefits of artificial intelligence, there are also certain barriers and disadvantages to keep in mind.

Limitations of artificial intelligence

One of the main barriers to implementing AI is the availability of data. Data is often siloed or inconsistent and of poor quality, all of which presents challenges for businesses looking to create value from AI at scale. To overcome this, you should have a clear strategy from the outset for sourcing the data that your AI will require.

Another key roadblock to AI adoption is the skills shortage and the availability of technical staff with the experience and training necessary to effectively deploy and operate AI solutions. Research suggests experienced data scientists are in short supply as are other specialised data professionals skilled in machine learning, training good models, etc.

Cost is another key consideration with procuring AI technologies. Businesses that lack in-house skills or are unfamiliar with AI often have to outsource, which is where challenges of cost and maintenance come in. Due to their complex nature, smart technologies can be expensive and you can incur further costs for repair and ongoing maintenance. The computational cost for training data models etc can also be an additional expense.

Software programs need regular upgrading to adapt to the changing business environment and, in case of breakdown, present a risk of losing code or important data. Restoring this is often time-consuming and costly. However, this risk is no greater with AI than with other software development. Provided that the system is designed well and that those procuring AI understand their requirements and options, these risks can be mitigated.

See also Industry 4.0 challenges and risks.

Other AI limitations relate to:

implementation times, which may be lengthy depending on what you are trying to implement

integration challenges and lack of understanding of the state-of-the-art systems

usability and interoperability with other systems and platforms

If you're deciding whether to take on AI-driven technology, you should also consider:

customer privacy

potential lack of transparency

technological complexity

If you're considering writing a tender document to procure AI, you can seek help from the Northern Ireland Artificial Intelligence Collaborative Network(link is external).

AI and ethical concerns

With the rapid development of AI, a number of ethical issues have cropped up. These include:

the potential of automation technology to give rise to job losses

the need to redeploy or retrain employees to keep them in jobs

fair distribution of wealth created by machines

the effect of machine interaction on human behaviour and attention

the need to address algorithmic bias originating from human bias in the data

the security of AI systems (eg autonomous weapons) that can potentially cause damage

the need to mitigate against unintended consequences, as smart machines are thought to learn and develop independently

While you can't ignore these risks, it is worth keeping in mind that advances in AI can - for the most part - create better business and better lives for everyone. If implemented responsibly, artificial intelligence has immense and beneficial potential.

When testing for current in a cable with eleven ​color-coded wires, the author used a meter to test five wires at a time. how many different tests are required for every possible pairing of five ​wires?

Answers

Multiply 5 times 5, then times 11, and you'll get 275.

What is the features of Mark 1​

Answers

Answer:

Okay:

Mark I was enourmous in size, measuring 8 feet high, 51 feet long and three feet deep. It weighed 5 tons, used 530 miles of wire and 730,000 separate parts. The operation of these parts was powered and synchronized by a long horizontal rotating shaft. A four horsepower engine drives the mechanical parts.

Harvard Mark I, an early protocomputer, built during World War II in the United States. While Vannevar Bush was working on analog computing at the Massachusetts Institute of Technology (MIT), across town Harvard University professor Howard Aiken was working with digital devices for calculation. He had begun to realize in hardware something like the 19th-century English inventor Charles Babbage’s Analytical Engine, which he had read about. Starting in 1937, Aiken laid out detailed plans for a series of four calculating machines of increasing sophistication, based on different technologies, from the largely mechanical Mark I to the electronic Mark IV.

Explanation:

hope it is helpful to you

Which of these is a biotic factor in a forest?
Will
O A. Climate
O O
O B. Terrain
O C. Trees
O D. Water​

Answers

Answer: trees

Explanation:

______ greetings are used when we talk to friends or family members.

A)Formal

B)Informal

C)Gestures

D)None of these​

Answers

Answer:

B. Informal

Explanation:

You know your parents, greet them normally

Answer:

Informal

Explanation:

Draw a truth table & logic circuit corresponding to the following logic statement
X = 1 if ( ( M is 1 OR N is 1 ) AND ( M is 1 AND N is 1 ) ) OR ( O is NOT 1 )

Answers

Answer:

The truth table, as well as the logic circuit of the given statement, is attached below.

Explanation:

Logical gates seem to be the essential building blocks of just about any computerized signal. It becomes a digital device with one or even more inputs and therefore only single output. The arrangement among outputs and inputs would be focused on this kind of logic. Upon that basis, logic gates were already called as AND, NOT, OR gate, etc.

Another problem related to indefinite postponement is called ________. This occurs when a waiting thread (letâ s call this thread1) cannot proceed because itâ s waiting (either directly or indirectly) for another thread (letâ s call this thread2) to proceed, while simultaneously thread2 cannot proceed because itâ s waiting (either directly or indirectly) for thread1 to proceed. The two threads are waiting for each other, so the actions that would enable each thread to continue execution can never occur.

Answers

Answer:

"Deadlock" is the right solution.

Explanation:

A deadlock seems to be a circumstance where certain (two) computer algorithms that share a similar resource essentially prohibit each other during manipulating the asset, leading to both programs withdrawing to operate.This occurs when multiple transfers or transactions block everyone by maintaining locks onto assets that every other activity also needs.

So that the above is the correct answer.

How to Fix 0xc000007b

Answers

Answer:

Method 1. Restart your computer

The first thing to try is restarting Windows. It sounds too simple, but it sometimes yields results.

Method 2. Update .NET framework

In most cases it's Microsoft .NET framework causing the issues. You can download the latest version of .NET Framework from Microsoft.

When it's installed (or re-installed) reboot and try your app or game again

Method 3. Enable Administrator rights

Try running the game or app with admin rights. To do that, right-click on the shortcut or the actual executable for the game, select Properties and open the Compatibility tab. Tick the 'Run this program as an administrator' box, and click on OK.

Method 4. Reinstall the app or game

You can uninstall and re-installing the game or program you're trying to run - simple but sometimes the quickest and most effective way to get rid of the error.

Method 5. Update Windows

Update Windows. In many cases Windows will automatically update, but to check, head to Control Panel and search for 'Windows Update'.

In later versions, including Windows 10, you can open the new Settings app (just search the Start menu or click the cog icon which appears just above the Windows logo when you click it in the bottom-left of the screen.

In the Settings app, click on Update & Security then you should see a button to check for updates:

Explanation:

Method 6. Run ChkDsk

Run chkdsk by opening cmd (search for it or press Win+R).

In the window type "chkdsk c: /f /r". If it is the primary windows disk, it will ask you to schedule it for next boot. When you restart, it will do a check before get to the login screen. Partitions or other drives can also be checked this way.

Method 7. Reinstall DirectX

This can be the fix for games that won't load. The way to do this depends on your version of Windows and which version of DirectX you need. There are full instructions on Microsoft's website

Hope it's help you. :-)

For safety, the lights on your vehicle must be in good working condition. Which statement about
checking your lights is true?
A: You must check all your lights often, and promptly replace any burned out boys
B: You should check your lights every six months and replace any burned out bulbs.
C: On modern cars, the lights are so reliable that you almost never have to check them,

Answers

Answer:

The answer is B

Explanation:

What are the useful techniques in program design?

Answers

A broad question, with many answers.

When designing a program you can use:

Setting up requirements, possibly in a use-case form ("as a ... I want to ... so that ...")Mapping the verbs and nouns in your requirements to classes and operations Drawing UML diagrams of the subject matterCreating flow charts and sequence diagrams Identify component boundaries with thin interfaces to keep complexity organized and local

What are examples of some Exotic currencies?
A) EURUSD, AUDUSD
B) GBPCHE, EURUSD
C) AUDCHF, NZDJPY
D) MXN, ZAR, HKD

Answers

Answer:

D) MXN, ZAR, HKD

Explanation:

Exotic currencies refer to currency that are used in countries with emerging economies therefore they lack liquidity, are extremely volatile and have very low volumes. The exchange rate of exotic currencies are usually very high because of its lack of liquidity, therefore trading these currencies are expensive. Examples of exotic currencies are South African rand (ZAR), Mexican peso (MXN), Hong Kong dollar (HKD), Chinese yuan (CYN), Turkish lira (TRY) and so on.

Mention 2 precautionary
measures to be observed
when using ICT tools​

Answers

Answer:

ICT is the abbreviated form of Information and Communication. It included different technologies like mobile phones, computers, USBs etc.

Following are two precautionary measures which should be observed when using any kind of ICT:

Use of Antivirus: It can used to protect anything placed inside the technology especially from hacking and viruses which can create many issues.Backup Data: Creating a backup of the data stored in the device is important as it can be recalled when the device malfunctions. Backup of the data can be created through using USBs, CDs etc or through cloud storage

What visual practice provides more information about logical relations when creating an ERD

Answers

Answer:

Logical Data Model

Explanation:

An Entity Relationship Diagram (ERD) is a model or a diagram designed to reveal the relationship between various entities such as people, places, objects, and so on within an institution. Entity relationship diagram is also known as Entity relationship model. This model is used to design relational database by various sectors such as education, engineering, business, etc.

ERD is designed using conceptual data model, logical data model, and physical data model.

The visual practice or model that gives more insight into the logical relations among the entity is the logical data model.

The logical data model is used to illustrate more detailed operational and relational data among the entities. It is more detailed than the conceptual data.

So, the correct answer is logical data model.

What does “int” means in php code

Answers

Answer:

integer

Explanation:

The database model that uses a series of two-dimensional tables or files to store information is the ________________ model. This database model has become the most popular database structure, as it is used by most microcomputer DBMS packages:

Answers

Answer:

The relational database model

Explanation:

The database model that uses a series of two-dimensional tables or files to store information is the relational structure model.

What is the relational structure model?

The relational model (RM) is known to be set up for database management as it is a method used in managing data via the use of a structure and language that are in line with first-order predicate logic.

Note that The database model that uses a series of two-dimensional tables or files to store information is the relational structure model.

Learn more about database from

https://brainly.com/question/26096799

#SPJ9

Why are the social and ethical consequences of emerging technology hard to
predict?

Answers

Answer:

Technology is rapidly evolving over a short period of time. Which leads to a change in how people perceive and subsequently react to these fast paced advances.

Answer: try this one: It is impossible to see how technology will be applied to situations that have not yet occured.

Explanation: if it’s wrong please tell me

Other Questions
pls help :( 100 points + brainliest Write a short story satirizing a particular aspect of your school. Keep the following questions in mind as you write: What aspect are you satirizing? Is your satire obvious or subtle? How are you using hyperbole in your satire? How would you like your writing to change the aspect you are satirizing? Examples: school policy regarding dress code lack of proper equipment in gym lack of adequate amenities ***if you could do two paragraphs then I will mark brainliest :))) Which compound is used to make asphalt? a saturated hydrocarbon that has more than 35 carbons in its chain a saturated hydrocarbon that has between 17 and 35 carbons in its chain a saturated hydrocarbon that has between 5 and 8 carbons in its chain a saturated hydrocarbon that has between 1 and 2 carbons in its chain You are the supervisor for a team of employees who have a high number of product defects. They also waste materials. You recognize that products defects and wasted materials affect your department's budget. You have told your team to decrease the amount of wasted materials, bur your employees do not seem to are. How can you get them to increase their quality and decrease waste The nth term of a sequence is n(n - 1).What are the first four terms?What is the 50th term?Is 59 a term in the sequence?Which term is 182?The ______ th term What is the political and social environment in which Malala is delivering her speech? Write a number with 2 decimal places, that is bigger than 4 and 1/5 but smaller than 4.25? What is the product of Three-fourths and Negative StartFraction 6 over 7 EndFraction?Negative StartFraction 7 over 8 EndFractionNegative StartFraction 9 over 14 EndFractionStartFraction 9 over 14 EndFraction Whats the velocity of a ball falling with 100 joules of kinetic energy and a mass of 2 kilograms? Use the formula, . A.3 m/s B.5 m/s C.7 m/s D.8 m/s E.10 m/s 24.Most police academies strive to blend training with education.25.Generally, basic preservice training is academy-based training that introduces recruitsto police work, provides an overview of the justice system, and includes classes onspecific skills and knowledge areas related to police work.In addition to the traditional skill-based subjects (e.g., firearms, defensive tactics) andconcepts (e.g., criminal law) taught in basic pre-service training, recruits should berequired to master subjects related to26.27.Obedience-oriented, military-style, stress recruit training programs28.Stress-related training in police academies, where it exists, should29.The Field training officer (FTO) is a knowledgeable, seasoned, and competent officertrained in adult education and evaluation procedures, who supervises recruits' on-the-job(field) training Plzzz helpppp urgenly A shoe store marks up the wholesale cost of all shoes they sell by 20%. Calvin wants to buy a pair of shoes that has a price tag of $145. What was the wholesale cost of the shoes? In her research on social interactions, Dr. Fisher anticipates that people of the same racial background will interact more with each other than they will with people of different races. She then conducts research to test this idea. Dr. Fisher's prediction is an example of a(n) ________. Why is a free press important to a democratic society? If f(x) = squareroot x + 5 and g(x) = -4x + 4,which statement is true?Click on the correct answer.3 is in the domain of fg.3 is not in the domain of fg. put the events in order a. D-Day b. Potsdam Conference c. V-J Day d. Yalta Conference e. V-E Day If a key is pressed on a piano, the frequency of the resulting sound will determine the ________, and the amplitude will determine the ________ of the perceived musical note. Ace Industries has current assets equal to $3 million. The company's current ratio is 1.5, and its quick ratio is 1.1. What is the firm's level of current liabilities? What is the firm's level of inventories? Do not round intermediate calculations. Round your answers to the nearest dollar. But I always thought the best part of it was at her canonization the guy who killed her, after doing twenty-seven years in prison, received communion side by side with Maria Goretti's mother. Isn't that weird? That amount of goodness? Quote analysis Imagine a player getting ready for a tournament. He has 4 games to play during the day: 9:00 a.M., 11:00 a.M., 1:00 p.M., and 3:30 p.M. He refuses to wear shorts until temperature rises to at least +5 degrees. Based on a starting temperature of -9 degrees at 6am and an increase in temperature of 2 degrees an hour, when might he be able to change from his pants to shorts? Provide explanations why he can/can't put his shorts on for Game 1, Game 2, Game 3 and Game 4. Cmo se dice "receipt" en espaol?A. El cambioB. El reciboC. El centavoD. El kilo