Computer Science, asked by UnknownMan619, 9 months ago

write a program to remove the character which have odd index value of a given string in python​

Answers

Answered by mfb8525
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 wordsbyme2019
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