n = 1while 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] = fenprint(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] + 1print(result)