Google Python クラスの一部である string1 演習に取り組んでいます。私が問題を抱えている質問はCです:
C. fix_start
Given a string s, return a string
where all occurences of its first char have
been changed to '*', except do not change
the first char itself.
e.g. 'babble' yields 'ba**le'
Assume that the string is length 1 or more.
Hint: s.replace(stra, strb) returns a version of string s
where all instances of stra have been replaced by strb.
ループを使用して各文字を最初の文字と比較し、一致するものを「*」に置き換えることを考えていました。もっと簡単な方法が必要だと思います。誰か提案はありますか?