+ 1
How to write a loop that prints out index of every 'i' in 'Mississippi'
4 Respostas
+ 7
for idx, letter in enumerate('Mississippi'):
if letter == 'i':
print(idx)
+ 7
Tibor Santa why so complicated?
for i in range (len ('Mississippi') - 1):
if 'Mississipi' [i] == 'i':
print (i)
+ 3
Another way:::
string='Mississippi'
k=0
for i in string:
if(i=='i'):
print(k)
k=k+1