write a program to remove the character which have odd index value of a given string in python
Answers
Answered by
1
Answer: try this
def odd_values_string(str):
result = ""
for i in range(len(str)):
if i % 2 == 0:
result = result + str[i]
return result
print(odd_values_string('abcdef'))
print(odd_values_string('python'))
Answered by
0
Answer:
Explanation:
def oddstring(str):
string = ""
for i in range(len(str)):
if i % 2 == 0:
string = string + str[i]
return string
Similar questions