摘要: 第6章函数-1 使用函数求特殊a串数列和 def fn(a,n): sum = 0 for i in range(n): sum = sum + a * pow(10,i) * (n - i) return sum a,n = input().split(" ") s = fn(int(a),int 阅读全文
posted @ 2021-10-27 21:10 闲晚 阅读(333) 评论(0) 推荐(0)
摘要: 第6章-1 输入列表,求列表元素和(eval输入应用) ls = eval(input()) sum = 0 for t in ls: sum = sum + t print(sum) 第6章-2 一帮一 num = eval(input()) count = 1 students = [] mat 阅读全文
posted @ 2021-10-27 20:53 闲晚 阅读(187) 评论(0) 推荐(0)
摘要: 第5章-1 输出星期名缩写 num = eval(input()) abbr = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"] print(abbr[num - 1]) 第5章-2 图的字典表示 num = eval(input()) count = 1 l 阅读全文
posted @ 2021-10-27 20:46 闲晚 阅读(282) 评论(0) 推荐(0)