Python 计算区间内位数和为10的四位数
try: s = input() a, b = map(int, s.split()) res = [] for i in range(a, b + 1): digits = list(str(i)) digit_sum = sum(map(int, digits)) if digit_sum == 10: res.append(i) print(*res) except: print('Input Error!')
原文地址: https://www.cveoy.top/t/topic/nZD5 著作权归作者所有。请勿转载和采集!