Q:

Write a Python program to remove the characters which have odd index values of a given string.

0

 Write a Python program to remove the characters which have odd index values of a given string. 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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'))

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now