评委打分,电影打分,统计所给车辆是不同地方的一共有多少

n = 1
while n <=10:
    fen=int(input('请第%s号评委评分:'%n))
    if fen < 5 or fen > 10:
        print('是不是傻?')
        continue
    else:
        print('第%s评委打分为:%s'%(n ,fen))
    n +=1
lis = ['变形金刚4','复仇者联盟4','无问东西','前任3','捉妖记2']
dic = {}
for i in lis:
    fen = input('请给%s打分:'%i)
    dic[i] = fen
print(dic)
cars = ['鲁A12341','鲁B23453','京A45974','皖D23234','沪A45783']
locals = {'':'山东','':'北京','':'安徽','':'上海'}
result = {}
for car in cars :
    first_name = car[0]
    location = locals[first_name]
    if result.get(location) == None :
        result[location] = 1
    else:
        result[location] = result[location] + 1
print(result)

 

posted on 2019-05-06 15:47  Little_Raccoon  阅读(165)  评论(0编辑  收藏  举报