Search This Blog

Thursday, September 24, 2020

NPTEL Assignment Solution for Data structures and algorithm using Python

 Write a function delchar(s,c) that takes as input strings s and c, where c has length 1 (i.e., a single character), and returns the string obtained by deleting all occurrences of c in s. If c has length other than 1, the function should return s

 def delchar(s,c):
  k=s.replace(c,"")
  return k

No comments:

Post a Comment