BC45 小乐乐改数字
思路:
step1:输入字符;
step2:遍历字符,如果可以整除2,则将i用0替换;否则用1替换;
step3:打印整数n
代码如下:
n = input()
for i in n:
if int(i)%2 == 0:
n = n.replace(i,'0')
else:
n = n.replace(i,'1')
print(int(n))
n = input()
for i in n:
if int(i)%2 == 0:
n = n.replace(i,'0')
else:
n = n.replace(i,'1')
print(int(n))