please write answers for these questions Part 1 1. Create three dictionaries: dic1 = {1:10, 2:20} dic2 = {3:30, 4:40} dic3 = {5:50, 6:60} (a) Write code to concatenate these dictionaries to create a new one. Create a variable called nums to store the resulting dictionary. There are multiple ways to do this, however, one of the easiest is to convert each of the dictionaries items to a list (which can be added together) and pass them to the dict() constructor. (b) Write code to add a new key/value pair to the dictionary nums: (7, 70) (c) Write code to update the value of the item with key 3 in nums to 80 (d) Write code to remove the third item from dictionary nums. (e) Write code to sum all the items in the dictionary nums (f) Write code to multiply all the items in the dictionary num

A Guide to SQL
9th Edition
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Philip J. Pratt
Chapter7: Database Administration
Section: Chapter Questions
Problem 7TD: Delete the index named ITEM_INDEX3.
icon
Related questions
Question

please write answers for these questions

Part 1
1. Create three dictionaries:
dic1 = {1:10, 2:20}
dic2 = {3:30, 4:40}
dic3 = {5:50, 6:60}
(a) Write code to concatenate these dictionaries to create a new one. Create a
variable called nums to store the resulting dictionary. There are multiple ways to
do this, however, one of the easiest is to convert each of the dictionaries items to a
list (which can be added together) and pass them to the dict() constructor.
(b) Write code to add a new key/value pair to the dictionary nums: (7, 70)
(c) Write code to update the value of the item with key 3 in nums to 80
(d) Write code to remove the third item from dictionary nums.
(e) Write code to sum all the items in the dictionary nums
(f) Write code to multiply all the items in the dictionary nums
(g) Write code to retrieve the maximum and minimum values in nums.

2. Create two sets:
set1 = {20, 40, 60}
set2 = {10, 20, 30, 40, 50, 60}
(a) Write code to perform a union of these sets. Print the length of the resulting set.
(b) Write code to perform an intersection of set1 and set2.
(c) Write code to compute the symmetric difference between set1 and set2
(d) Write code to add the value 40 to set1, did the set change?
(e) Write code to remove value 20 from set2.

Part 2
1. Create a dictionary named password_lookup that contains usernames as
keys and passwords as associated string values. Make up data for five entries.
2. Write a program that creates an initially empty dictionary named
password_lookup, prompting one-by-one for usernames and passwords
(until a username of 'z' is read) entering each into the dictionary.
3. Create a dictionary named password_hint that contains email addresses
as keys, and associated values that contain both the users’ “password security
question,” and the answer to the question. Make up data for dictionary entries.
4. Create a dictionary named member_table that contains users’ email
addresses as keys, and answers to their password hints as the associated values,
and a function that generates a temporary new password and stored in the table.
5. Declare a set named vowels containing the strings 'a','e','i','o',
'u'. Create a function called count_vowels that prompts the user for any
English word and displays how many vowels it contains.
6. Create a function called word_intersection that prompts the user for
two English words, and displays which letters the two words have in common.
Convert each string to a set type in order to solve this problem.
7. Create a function called word_difference that prompts the user for two
English words, and displays which letters are in the first word but not the
second. Convert each string to a set type in order to solve this.
8. Create a function called get_missing_letters that prompts the user for
two English words, and displays which letters of the alphabet are in neither of
the two words. Convert each string to a set type in order to solve this.
9. Create a function called word_sdifference that prompts the user for two
English words, and displays which letters are in either the first word or the
second word, but not both words. Convert each string to a set type in order to
solve this.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Dictionary
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr