Edhesive 9.7 Code Practice Question 3
w = ["Algorithm", "Logic", "Filter", "Software", "Network", "Parameters", "Analyze", "Algorithm", "Functionality", "Viruses"]
s=[]
for word in w:
l = len(word)
s.append(l)
print(l,word)
Idk how to do it i need help
Answers
Corrected program: (INDENTATION is must!)
w = ["Algorithm", "Logic", "Filter", "Software", "Network", "Parameters", "Analyze", "Algorithm", "Functionality", "Viruses"]
s=[]
for word in w:
l = len(word)
s.append(l)
print("{0}: {1}".format(l,word)))
Output:
9: Algorithm
5: Logic
6: Filter
8: Software
7: Network
10: Parameters
7: Analyze
9: Algorithm
13: Functionality
7: Viruses
Explanation:
Here, you are printing each element from the list and its length.
In addition, you are appending the length of each word into a list named 's' such that each word's length will be on the corresponding index in the list 's'
To get the list of lengths, once done with the loop, just print the list 's' with the statement print(s).
It gives the list of lengths as output.
Learn more:
1) Printing all the palindromes formed by a palindrome word.
brainly.in/question/19151384
2) Indentation is must in python. Know more about it at :
brainly.in/question/17731168