0% found this document useful (0 votes)
5 views1 page

Python Programming Tasks Examples

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Python Programming Tasks Examples

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python Programming Tasks

1. Word Frequency Counter Write a program to count word


frequencies in a given text.
text = input("Enter text: ")
words = [Link]()
freq = {}

for word in words:


word = [Link]()
freq[word] = [Link](word, 0) + 1

print("Word Frequencies:")
for word, count in [Link]():
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 [Link]() == [Link]()[::-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)

You might also like