Python2 Saved Program: kind-life

facebook share

Here's the online compiler accompanied with IDE at your service. This is a saved code by one of our users. Try it out or save your own from the IDE page and don't forget to leave a feedback. You can find that at the bottom of the page.


#Come on. You can change the whole world with a few lines of code
def phno():
  
  D={}
  n1=raw_input("Enter a name:")
  n2=raw_input("Enter a name:")
  n3=raw_input("Enter a name:")
  ph1=int(raw_input("Enter phone number:"))
  ph2=int(raw_input("Enter phone number:"))
  ph3=int(raw_input("Enter phone number:"))
  D[n1]=ph1
  D[n2]=ph2
  D[n3]=ph3
  n=raw_input("Enter a name to get its phone number:")
  if n in D:
    print D[n]
  else:
    print "invalid name"
Execute

Output

Press the execute button or CTRL + enter to run code.

Inputs