Skip to content

Commit

Permalink
Merge pull request #66 from jyotika6221/main
Browse files Browse the repository at this point in the history
Create contactbook.pyCB
  • Loading branch information
kishanrajput23 committed Oct 9, 2022
2 parents 60c33fa + bb10e59 commit 6b3c60c
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions contactbook.pyCB
@@ -0,0 +1,28 @@
names = []
phone_numbers = []
num = 3


for i in range(num):
name = input("Name: ")
phone_number = input("Phone Number: ") # for convert to int => int(input("Phone Number: "))

names.append(name)
phone_numbers.append(phone_number)

print("\nName\t\t\tPhone Number\n")

for i in range(num):
print("{}\t\t\t{}".format(names[i], phone_numbers[i]))

search_term = input("\nEnter search term: ")

print("Search result:")

if search_term in names:
index = names.index(search_term)
phone_number = phone_numbers[index]
print("Name: {}, Phone Number: {}".format(search_term, phone_number))

else:
print("Name Not Found")

0 comments on commit 6b3c60c

Please sign in to comment.