标签:png .com hide bsp 一个 个数 check isp 循环
num = input(‘请输入数字>>>‘).strip() new_num = num if num.isdigit(): sum1 = 0 check = [] while sum1 !=1: for i in check: if check.count(i) >= 2: print(new_num+‘不是快乐数!‘) exit() li = [] for i in str(num): li.append(int(i)) l = map(lambda x: x ** 2, li) ki = [] for i in l: ki.append(i) sum1 = sum(ki) check.append(sum1) num = sum1 else: print(new_num+‘是快乐数!‘) else: print(‘错误的输入!不是数字!‘)
标签:png .com hide bsp 一个 个数 check isp 循环
原文地址:https://www.cnblogs.com/pandaboy1123/p/9406277.html