MENU
Question -

Create a function countPages(x) that takes the number of pages of a book as an argument and counts the number of times the digit тАШ1тАЩ appears in the page number.



Answer -

def countPages(num):
total = 0
i = 1
while i<=num:
page_no = str(i)
total + = page_no.count(тАШ1тАЩ)
i+ = l
return total

Comment(S)

Show all Coment

Leave a Comment

Free - Previous Years Question Papers
Any questions? Ask us!
×