摘要:
代码: def read_file(): result=[] with open("./student_grade_input.txt") as fin: for line in fin: line=line[:-1] result.append(line.split(",")) return re 阅读全文
摘要:
代码: import random list=["xyla","tom","hrh","monkey","c","b","a","2","1"] i=int(input("Please enter an integer: ")) while i!=100: j=random.sample(list, 阅读全文
摘要:
代码: def match_num(num): f=[6,2,5,5,4,5,6,3,7,6] if num==0: total=f[0] else: total=0 while num>0: x=num%10 total=total+f[x] num=num//10 return total sn 阅读全文
摘要:
代码: for i in range(1,10): for j in range(1,i+1): print("{0:1}*{1:1}={2:<2} ".format(j,i,j*i),end="") print() 效果: 1*1=1 1*2=2 2*2=4 1*3=3 2*3=6 3*3=9 1 阅读全文
摘要:
代码: import pdb money=50000 rate=[0.0325,0.03,0.03,0.02,0.0175] for i in rate: money=round(money+money*i,2) print("Five years later,your wealth is:",mo 阅读全文