Untitled
unknown
python
a month ago
454 B
5
Indexable
def func(string,ch,num): counter = num returned_str = "" for i in string: if ord(i) == ord(ch) and counter != 0: if 32 < ord(i) < 47: returned_str += chr(ord(i)) else: returned_str += chr(ord(i)- 32) counter -= 1 else: returned_str += chr(ord(i)) return returned_str def main(): print(func("abc$","$",1)) main()
Editor is loading...
Leave a Comment