摘要:
# 十进制转化为N进制def func1(s: str, s_base:int, n_base: int): baselist = '0123456789ABCDEF' res = str(s) # 原数不是十进制时,先转为十进制:累加 if s_base != 10: ssum = 0 s = s 阅读全文
摘要:
# 匹配()def func1(s: str): temp = [] for i in s: if i in '(': temp.append(i) else: if i in ')': if temp: temp.pop() else: return False if temp: return F 阅读全文
摘要:
# 逐一比对法def func1(s1: str, s2: str): if len(s1) != len(s2): return False for i in range(len(s1)): if s1[i] in s2: s2 = s2.replace(s1[i], '') if s2 == ' 阅读全文