from random import randint list = [["" ,"阿大" ], ["" ,"小二" ], ["" ,"张三" ], ["" ,"李四" ], ["" ,"王五" ], ] for i in range(0,5): list[i][0] = 20170000+randint(0,10000) for j in range(0,3): list[i].append(randint(60,100)) aug=0 for i in range(len(list)): aug = (list[i][2] + list[i][3] + list[i][4])/3 aug_1 = float("{0:.2f}".format(aug)) list[i].append(aug_1) print("学号 姓名 Java C语言 Python 平均分") for i in list: for j in i: print(j,end=" ") print("\t") aug_j,aug_c,aug_p,max = 0,0,0,0 n = len(list) min = list[0][2] for i in range(len(list)): aug_j += list[i][2] aug_c += list[i][3] aug_p += list[i][4] for j in range(2, 5): if(list[i][j]>max): max =list[i][j] if(list[i][j]<min): min =list[i][j] print("Java的平均值:{}\nC语言的平均值:{}\nPython的平均值:{}\n最大值:{}\n最小值:{}".format(aug_j,aug_c,aug_p,max,min))
https://gitee.com/Miracle-Fan/codes/ahjvd35yui1c42qmleoxw10
money = input("请输入需要兑换的货币:") try: if money[0]=='$': rmb = eval(money[1:]) * 6 print("兑换后的货币为:Y{:.2f}".format(rmb)) elif money[0]=='Y': dollar = eval(money[1:]) / 6 print("兑换后的货币为:${:.2f}".format(dollar)) else: print("输入错误,请重新输入") except: exit(0)
https://gitee.com/Miracle-Fan/codes/ahjvd35yui1c42qmleoxw10