1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vika [28.1K]
3 years ago
8

Write a program that asks for 'name' from the user and then asks for a number and stores the two in a dictionary (called 'the_di

ct') as key-value pair. The program then asks if the user wants to enter more data (More data (y/n)? ) and depending on user choice, either asks for another name-number pair or exits and stores the dictionary key, values in a list of tuples and prints the list. Note: Ignore the case where the name is already in the dictionary. Example: Name: pranshu Number: 517-244-2426 More data (y/n)? y Name: rich Number: 517-842-5425 More data (y/n)? y Name: alireza Number: 517-432-5224 More data (y/n)? n [('alireza', '517-432-5224'), ('pranshu', '517-244-2426'), ('rich', '517-842-5425')]
Computers and Technology
1 answer:
babymother [125]3 years ago
5 0

Answer:

Okay. I am doing it with Python. Hope it'll help you to understand the concept.

Code:

the_dict={}   #Creating a dictonary

def dat():    # Creating a function named dat()

   

   name = input('Your Name: ')   # Data from user

   ph = input('Phone Number: ')

   for i in range(1):  #Creating loop

       the_dict[name]=ph   # Placing the value in dictonary

   more = input('More Data (y/n): ')   # Asking for More data

   if more == 'y':   # if more is y then run the function dat()

       dat()   # calling dat()

   elif more == 'n':   # if more is n then print the dictonary named 'the_dict'

       print(the_dict)

   else:

       print('Wrong Input')  # if wrong input print the message and run dat() again

       dat()

dat()  # calling the function

   

Result:

Your Name: PyMan

Phone Number: 9814579063

More Data (y/n): y

Your Name: PyMman2

Phone Number: 451513262026

More Data (y/n): y

Your Name: C#Man

Phone Number: 7798822222

More Data (y/n): n

{'PyMan': '9814579063', 'PyMman2': '451513262026', 'C#Man': '7798822222'}

You might be interested in
Create a security management policy that addresses the management and the separation of duties throughout the seven domains of a
klio [65]

Seven Domains of IT Infrastructure Seven domains can be found in a typical IT infrastructure. They are as follows: User Domain, Workstation Domain, LAN Domain, LAN-to-WAN Domain, Remote Access Domain, WAN Domain, and System/Application Domain.

Explanation:

User Domain : The User Domain covers all theusers (of any rank) that haveaccess to the other six domains.

RISKS:

  • User can destroy data in application(intentionally or not) and delete all
  • User can insert infected CD or USBflash drive into the work computer

Workstation Domain : A computer of an individual user where the production takes place

RISKS:

  • The workstation’s OS can have a known software vulnerability thatallows a hacker to connect remotelyand steal data.
  • A workstation’s hard drive can fail causing lost data

LAN Domain : Contains all of the workstations,hubs, switches, and routers. TheLAN is a trusted zone

RISKS:

  • A worm can spread through the LANand infect all computers in it.
  • LAN server OS can have a knownsoftware vulnerability.

WAN Domain : Stands for Wide Area Network and consists of the Internet and semi-private lines

RISKS:

  • Service provider can have a major network outage.
  • Server can receive a DOS or DDOS attack.
  • A FTP server can allow anonymously uploaded illegal software

LAN / WAN Domain : The boundary between the trusted and un-trusted zones.The zones are filtered with a firewall

RISKS:

  • Weak ingress/egress traffic filteringcan degrade performance.
  • A firewall with unnecessary portsopen can allow access from the Internet

System / Application Storage Domain : This domain is made up of user-accessed servers suchas email and database

RISKS:

  • A fire can destroy primary data
  • A DOS attack can cripple the organization’s email

Remote Access Domain  :The domain in which a mobileuser can access the local network remotely, usually through a VPN

RISKS:

  • Communication circuit outage candeny connection.
  • Remote communication from officecan be unsecured.
  • VPN tunneling between remotecomputer and ingress/egress routercan be hacked
6 0
3 years ago
A 'array palindrome' is an array which, when its elements are reversed, remains the same (i.e., the elements of the array are sa
stiv31 [10]

Answer:

This code is written in MATLAB.

function [result] = isPalindrome(array,length)

if length == 0 || length == 1 %if the array is empty or contains only one element, the array is a palindrome

result = 1;

else

for i = 1:length/2 %check all the elements forward and backward until the middle is reached

if array(i) ~= array(end+1-i)

result = 0;

return

end

end

result = 1;

end

Explanation: Please read the comments in the code. In MATLAB, Boolean values are 1 or 0 instead of True or False.

6 0
3 years ago
What is the letter for the trash directory on windows 10?
myrzilka [38]
It's usually in C: drive.
<span>C:\$Recycle.Bin
</span>But if you have several drives, there are Recycle Bins each drive.
3 0
3 years ago
Read 2 more answers
Which of the following postfix expressions corresponds to the given infix expression?
Ivan

Answer:

C) 1 4 2 / + 1 + 2 + 3 * 2 /

Explanation:

Infix, Postfix and Prefix are 3 different ways of writing expressions which differ in relative placement of operator and operands.

In Infix , operator lies between the operands whereas in postfix operator is written after its operands.

For example: 1 + 2 is infix while 1 2 + is the corresponding postfix expression.

Converting the given infix expression (1 + 4 / 2 + 1 + 2) * 3 / 2 to postfix:

Let (1 + 4 / 2 + 1 + 2) be represented by x.

Converting x to postfix:

(1 + 4 / 2 + 1 + 2)  =>  1 4 2 / + 1 + 2 +       ------------------------- (1)

So the overall infix expression becomes:

x * 3 / 2

Converting it to postfix:

x 3 * 2 /

Replacing the value of x from (1)

1 4 2 / + 1 + 2 + 3 * 2 /

4 0
3 years ago
This is not a question but I am taking a vote of what device most people use​
Xelga [282]

I tend to use a playstation switch. It runs out of data very quickly though, even with the unlimited plan.

5 0
4 years ago
Other questions:
  • After a worksheet has been displayed in page layout view, page breaks are indicated by ________ in normal view.
    14·1 answer
  • The ____________________ packet-filtering firewall allows only a particular packet with a particular source, destination, and po
    10·1 answer
  • How do I only give 5 points and not 10?
    7·1 answer
  • Which of the following statements is true?
    5·1 answer
  • Which do switches create?<br> Networks<br> Wireless access points<br> Routes<br> Collision domains
    5·1 answer
  • Who tryna play among us
    8·2 answers
  • a. Create an Abstract class called Vehicle with abstract methods accelerate, stop, and gas, &amp; data of your choice (5 marks)
    12·1 answer
  • Please answer it’s timed
    14·1 answer
  • Ok I'm sorry to all those who are trying to messasge me on brainly my brainly inbox is not working and hasn't work since the beg
    12·2 answers
  • Write javascript code for the form that appears in the image below. you are expected to add validation to the name field, email
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!