从 第3章-8 字符串逆序 开始 1. n = str(input()) n1=n[::-1] print(n1) 2. 不是很好做这道题,自己还是C语言的思维,网上几乎也找不到什么答案 s = input() idx = s.find("#") s = s[:idx] ss = s[:idx] s_16 = "0123456789ABCDEFabcdef" for c in s: if c not in s_16: s = s.replace(c, '') fla…
第4章-15 换硬币 挺难的,这里学到一个range的用法: 也就是说range函数能实现顺序和倒序,取决于step是正是负 count = 0 x = int(input()) a = x // 5 for m in range(a,0,-1): b = (x - (m * 5)) // 2 for n in range(b,0,-1): c = x - (5 * m) - (2 * n) if m > 0 and n > 0 and c > 0: print("fen5:{…