Join IDNLearn.com and become part of a knowledge-sharing community that thrives on curiosity. Discover in-depth answers to your questions from our community of experienced professionals.
Sagot :
Multiple values can be stored in a single variable by using lists.
Program:
allContacts = input()
contactName = input()
splitContact = allContacts.split(" ")
for i in range(len(splitContact)):
if(splitContact[i] == contactName):
print(splitContact[i+1])
What is Lists?
- Multiple elements can be kept in a single variable by using lists.
- One of the four built-in data types in Python for storing data collections is the list; the other three are the tuple, set, and dictionary, each of which has a unique purpose.
- List items can have duplicate values and are ordered and editable.
- The first item in a list has the index [0], the second item has the index [1], etc.
- The list is modifiable, which means that after it has been generated, we can edit, add, and remove entries from it.
- The len() method can be used to count the number of elements in a list
- Lists can contain items with the same value since they are indexed
To learn more about Lists refer to:
https://brainly.com/question/560095
#SPJ4
Your participation means a lot to us. Keep sharing information and solutions. This community grows thanks to the amazing contributions from members like you. Find clear answers at IDNLearn.com. Thanks for stopping by, and come back for more reliable solutions.