Recursive function of Kitty CAT gene coding problem

CSDN Q & A 2022-05-15 04:50:24 阅读数:470



Want to implement input 01001011 The output is yes C Yes A Also have B But I didn't make it


On this topic

Take the answer :

such ?

def coding(s): n = len(s) #print(n) if s.count("0" ) == n: return 'A' elif s.count('1') == n: return 'B' else: return 'C' + coding(s[:n//2]) + coding(s[n//2:]) s = input()print(coding(s))

版权声明:本文为[CSDN Q & A]所创,转载请带上原文链接,感谢。