Question: Python with Flask This is my code: word=input(Type Something: ) listofwords=word.split() wordfreq = [] for w in listofwords: wordfreq.append(listofwords.count(w)) print(Word: +str(listofwords)+ ) print(Count: +str(wordfreq)
Python with Flask
This is my code:
word=input("Type Something: ")
listofwords=word.split()
wordfreq = []
for w in listofwords:
wordfreq.append(listofwords.count(w))
print("Word: "+str(listofwords)+ " ")
print("Count: "+str(wordfreq) + " ")
My code works fine. My only problem is that it prints it out:
Word: ['is', 'the', 'bus', 'at', 'the', 'terminal']
Count: [1, 2, 1, 1, 2, 1]
How do I have my results printout like this:
Word Count
"is" 1
"the" 2
"bus" 1
"at" 1
"the" 2
"terminal" 1
Also, which parts of my code should I put under "tr" and "td" in the table section of my html. I already have Word and Count under "th" and it works fine.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
