Q:

Write a Python program to get a string from a given string where all occurrences of its first char have been changed to $, except the first char itself

0

Write a Python program to get a string from a given string where all occurrences of its first char have been changed to $, except the first char itself

All Answers

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

def change_char(str1):
  char = str1[0]
  str1 = str1.replace(char, '$')
  str1 = char + str1[1:]

  return str1

print(change_char('restart'))

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