python3.6 Small Program

Source: Internet
Author: User

   # query class   
Python 3.6 pycharm Run (ERR)

people = {
' Wang Fei ': {
' phone ': ' 2341 ', '
' address ': ' Western town of Forget Chuan Cun '
},
' small flat three ': {
' phone ' : ' 9102 ',
' address ': ' Bliss Palace town, Prince Edward village 111th '
},
' Mitchell ': {
' phone ': ' 3158 ',
' address ': ' conveniently refer to the village of the Tathagata community a block 7 Building 2-storey Nishi '
}
}
KK = 0
Print ("The system can only query the population of xxx County, only for the time being rotation")
while True:
If KK < 3:
NA me = input (' Please enter the name to query: ')
If name in people:
REQUESR = input (' Please enter phone number (p) or address (a): ')
if requesr = = ' P ': requesr = ' phone '
if requesr = = ' a ': REQUESR = ' address '
person = people.get (name, {})
result = Person.get (REQUESR)
Print ("\t\t{} Home {} is: {}". Format (name, REQUESR, result))
KK + = 1
Continue
If KK = 3:
Break
Else:
Print ("The user has not logged ...")

Operation Result:
The system can only query the population of xxx County, only in the rotation of the way to inquire
Please enter the name to query: Wang Fei
Please enter your phone number (p) or address (a): a
The address of Wang Fei home is: Western Forget Chuan Cun
Please enter the name you want to query: small flat three
Please enter your phone number (p) or address (a): P
Small flat three phone number is: 9102
Please enter the name to query: Mitchell
Please enter your phone number (p) or address (a): a
Mitchell Home address is: Shun Finger Township Tathagata community a block 7 building 2-storey West

Jump out of the loop (exit the program)



python3.6 Small Program

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.