Explore IDNLearn.com's extensive Q&A database and find the answers you need. Whether it's a simple query or a complex problem, our experts have the answers you need.
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
Thank you for being part of this discussion. Keep exploring, asking questions, and sharing your insights with the community. Together, we can find the best solutions. Your search for answers ends at IDNLearn.com. Thank you for visiting, and we hope to assist you again soon.