Write a python program to count the number of characters of alphabets 'O' and 'i' from the given file

Question

Write a python program to count the number of characters of alphabets 'O' and 'i' from the given file
🧐 Not the exact question you are looking for?Go ask a question

Solution 1

Sure, here is a simple Python program that counts the number of 'O' and 'i' characters in a file:

def count_chars(filename):
    with open(filename, 'r') as f:
        text = f.read()
    count_O = text.count('O')
    count_i = text.count('i')
    return count_O, count_i

filename = 'your
    Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study prob
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solv

This problem has been solved

Similar Questions

Write a python program to count the number of characters of alphabets 'O' and 'i' from the given file

Write a python program to count the number of palindrome strings that occurred in the given string.

Write a Python program to count the number of occurrences of a specific character in a string

Write a Python program to get a dictionary value from the user and count the number of keys that are having the same value and print the count.

Write a python program to check the given number is Armstrong or not usingwhile loop.

1/3