Read a string from user input. The string must contain multiple characters. Delete all the characters that are in even positions. Print the resulting string.
Hint: Use math operator %, the for loop, and the if statement.
s = str(input())
itr = len(s)
for i in range(0,itr):
if i % 2 == 0:
print (s[i])
else:
s.remove(s[i])
Aucun commentaire:
Enregistrer un commentaire