第二次测试

1.随机生成10个6位密码

import random
s = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z",
     "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",
     "0","1","2","3","4","5","6","7","8","9"] 
for i in range(10):   
    for i in range(6):
        print(random.choice(s),end="") 
    print("\n")

2.输出三个数的最大值

x = int(input("输入第一个数: "))
y = int(input("输入第二个数: "))
z = int(input("输入第三个数: "))
if x > y:
    x, y = y, x
if x > z:
    x, z = z, x
if y > z:
    y, z = z, y
print(z)

3.学生成绩排序

f = open("score.txt","r")
last = {}
for i in f.readlines():
    last[i] = last.get(i)
items = list(last.items())
items.sort(key=lambda x:x[0], reverse=True) 
for i in range(10):
    i, count = items[i]
    print (i)