Computer Science
Write a program to count the number of uppercase alphabets present in a text file "Poem.txt".
Python Data Handling
3 Likes
Answer
Let the file "Poem.txt" include the following sample text:
PYTHON is a Popular Programming Language.
with open("Poem.txt", 'r') as file:
text = file.read()
count = 0
for char in text:
if char.isupper():
count += 1
print(count)
Output
9
Answered By
2 Likes
Related Questions
A file sports.dat contains information in following format:
Event - Participant
Write a function that would read contents from file sports.dat and creates a file named Atheletic.dat copying only those records from sports.dat where the event name is "Atheletics".Write a program to count the words "to" and "the" present in a text file "Poem.txt".
Write a program that copies one file to another. Have the program read the file names from user ?
Write a program that appends the contents of one file to another. Have the program take the filenames from the user.