Answer to Question #3385 in Python for mukunda

Question #3385
Write a python program to find any one contact from your mobile contacts.

(Note: take all the contacts in string and take any one contact to search)
1
Expert's answer
2011-08-02T14:17:20-0400
contacts = """
michael 34234234234
rahmanan 23453654564
budukozel 67854654623
"""

contact_to_find = "rahmanan"

for contact in contacts.split("\n"):
if contact:
& data = contact.split(" ")
& name, phone = data[0], data[1]
& if name == contact_to_find:
& print(name, phone)
& break

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS