Skip to content

Akashkanagaraj03/hpe-assignments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

hpe-assignments

Assessment 1:

Write a Python script that:

  1. Reads data from a text file called sentences.txt, where each line contains a sentence. The format of the file is:
Python is fun
Radar is a palindrome
The quick brown fox jumps over the lazy dog
A man a plan a canal Panama
  1. Processes each sentence to:

    • Count the number of words in each sentence.
    • Identify the longest word in each sentence.
    • Check if any word in the sentence is a palindrome (a word that reads the same backward and forward).
  2. Writes the results to a new file called sentence_analysis.txt with the following format:

Sentence: Python is fun
Word Count: 3
Longest Word: Python
Palindromes: None

Sentence: Radar is a palindrome
Word Count: 4
Longest Word: palindrome
Palindromes: Radar

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages