9.7 Code Practice: Question 2
Use the following initializer list:
w = ["Algorithm", "Logic", "Filter", "Software", "Network", "Parameters", "Analyze", "Algorithm", "Functionality", "Viruses"]
Write a loop to print the words that start with "A".
Sample Run
Algorithm
Analyze
Algorithm
Answers
Answer:
w = ["Algorithm", "Logic", "Filter", "Software", "Network", "Parameters", "Analyze", "Algorithm", "Functionality", "Viruses"]
for x in w:
if(x[0]=='A'):
print(x)
Explanation:
Language used: Python Programming
Program 1: (Using for loop)
w = ["Algorithm", "Logic", "Filter", "Software", "Network", "Parameters", "Analyze", "Algorithm", "Functionality", "Viruses"]
for word in w:
if word[0]=='A':
print(word)
Program 2: (Using while loop)
w = ["Algorithm", "Logic", "Filter", "Software", "Network", "Parameters", "Analyze", "Algorithm", "Functionality", "Viruses"]
i=0
while(i<len(w)):
if w[i][0]=='A':
print(word)
i=i+1
Program 3: (Using list comprehension)
w = ["Algorithm", "Logic", "Filter", "Software", "Network", "Parameters", "Analyze", "Algorithm", "Functionality", "Viruses"]
print([i for i in w if i[0]=="A"])
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