Codewars notes - 替换数字
exercise:
Given a string of digits, you should replace any digit below 5 with '0' and any digit 5 and above with '1'. Return the resulting string.
Note: input will never be an empty string
Solution:
def fake_bin(x): s2 = '' for i in x: if int(i) >= 5: i = "1" s2 += i else: i = "0" s2 += i return s2