Python Programming Tasks
1. Word Frequency Counter Write a program to count word
frequencies in a given text.
text = input("Enter text: ")
words = text.split()
freq = {}
for word in words:
word = word.lower()
freq[word] = freq.get(word, 0) + 1
print("Word Frequencies:")
for word, count in freq.items():
print(f"{word}: {count}")
2. Palindrome Checker Write a program that checks if a given
word is a palindrome.
word = input("Enter a word: ")
if word.lower() == word.lower()[::-1]:
print("Palindrome")
else:
print("Not a palindrome")
3. List Manipulation Create a list of numbers, then print the square
of each number.
numbers = [1, 2, 3, 4, 5]
squares = [n**2 for n in numbers]
print("Squares:", squares)