Write a python function to count 'a's in the repetition of a given string 'n' times.


Topic: Write a python function to count 'a's in the repetition of a given string 'n' times.

Solution

def repeated_string(s, n):
    return s.count('a') * (n // len(s)) + s[:n % len(s)].count('a')



List all Python Programs