简体   繁体   中英

How do I replace the following occurrences of the first letter with a "*"?

I got stuck on this and I don't know what to do from here.

# returns a string that changes all occurrences of its first char have been changed to '*'


def fix_start(str):
    results = []
    str.startswith(str[1])
    results = 

for example: given string = 'bubble' it should return: bu**le

def fix_start(s):
    return s[0]+ s[1:].replace(s[0],'*')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM