Welcome to Westonci.ca, the place where your questions are answered by a community of knowledgeable contributors. Join our platform to connect with experts ready to provide accurate answers to your questions in various fields. Get quick and reliable solutions to your questions from a community of experienced experts on our platform.
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
Thanks for stopping by. We strive to provide the best answers for all your questions. See you again soon. We appreciate your visit. Our platform is always here to offer accurate and reliable answers. Return anytime. Westonci.ca is your go-to source for reliable answers. Return soon for more expert insights.