Q1)
s = 'VINOTH'
word = list(s)
print(word)
key = word[0]
count = 1
i = 1
while i < len(word):
if key != '*' and key == word[i]:
word[i] = '*'
count+=1
i+=1
print(key, 'is present', count, 'times')
print(word)
Q2)
s = 'VINOTH KUMAR'
word = list(s)
print(word)
key = word[0]
count = 1
i = 1
while i < len(word):
if key != '*' and key == word[i]:
word[i] = '*'
count+=1
i+=1
print(key, 'is present', count, 'times')
#print(word)
key = word[1]
count = 1
i = 2
while i < len(word):
if key != '*' and key == word[i]:
word[i] = '*'
count+=1
i+=1
print(key, 'is present', count, 'times')
Q3)
key = word[2]
count = 1
i = 3
while i < len(word):
if key != '*' and key == word[i]:
word[i] = '*'
count+=1
i+=1
print(key, 'is present', count, 'times')
Top comments (0)