我正在研究屬於Google Python類的string1練習。我有問題,問題是C:google python class string1練習
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.
我想用一個循環比較的第一個字母一個字母一個用「*」代替任何比賽。我認爲必須有一個更簡單的方法。有沒有人有什麼建議?
最好的答案海事組織。 – AndreeCrist