Assume a text file “coordinate.txt” is already created. Using this file create a PYTHON function to count the number of words having first character capital.
f = open("Rajeev", "r+")
def count_char(li):
count = 0
for item in li:
if item[0].isupper():
count += 1
return count
count = 0
for li in f:
li = li.split()
count += count_char(li)
print(count)
Comments
Leave a comment