仪表设备,lady最后的犯罪画像,八木加奈耶
# c. fix_startdef fix_start(s): # +++your code here+++ # lab(begin solution) front = s[0] back = s[1:] fixed_back = back.replace(front, '*') return front + fixed_back
# e. not_bad
# given a string, find the first appearance of the
# substring 'not' and 'bad'. if the 'bad' follows
# the 'not', replace the whole 'not'...'bad' substring
# with 'good'.
# return the resulting string.
# so 'this dinner is not that bad!' yields:
# this dinner is good!
def not_bad(s): # +++your code here+++ # lab(begin solution) n = s.find('not') b = s.find('bad') if n != -1 and b != -1 and b > n: s = s[:n] + 'good' + s[b+3:] return s
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
python求numpy中array按列非零元素的平均值案例
网友评论