+ 2
Doubt on Data structure
Teacher, we can't use methods of a string with a list, or with any other data structure? My question is that there are different methods for different data structures, so we can't use them with each? Suppose we want to use the spite(), and append() method in a program then can we use them together?
1 Réponse
+ 1
def split_food(input, food_list):
#split the input
words = input.split()
for i in words:
food_list.append(i)
return food_list