第六天(学习第8天)

Day6作业及默写

1,老男孩好声⾳选秀⼤赛评委在打分的时候呢, 可以进⾏输入. 假设, 老男孩有10个评委. 让10个评委进⾏打分, 要求, 分数必须⼤于5分, ⼩于10分.

pingweixi=['q','w','e','r','t','y','u','i','o','p']
n=1
lst=[]
while n <= len(pingweixi):
    s=input("请%s评委打分: " %(pingweixi[n-1]))
    #n = n + 1
    if s.isdigit():
        s=int(s)
        if s > 10 or s < 5:
            print("请输入正确的分数")
        else:
            lst.append(s)
            n=n+1
        continue
    else:
        print("你输入的数据有误,请重新输入")
        continue
print(lst)

2. 电影投票. 程序先给出⼀个⽬前正在上映的电影列表. 由⽤户给每⼀个电影投票. 最终 将该⽤户投票信息公布出来 lst = ['⾦瓶梅', '解救吾先⽣', '美国往事', '⻄⻄⾥的美丽传说'] 结果: {'⾦瓶梅': 99, '解救吴先⽣': 80, '美国往事': 6, '⻄⻄⾥的美丽传说': 23}

lst = ['⾦瓶梅', '解救吾先⽣', '美国往事', '⻄⻄⾥的美丽传说']
dic={}
c=1
while c<=len(lst):
    s=input("请给%s电影投票: " %(lst[c-1]))
    if s.isdigit():
        s=int(s)
        if s>100 or s<0:
            print('输入的分数有误,请重新输入: ')
            continue
        else:
            dic[lst[c-1]] = s
            c=c+1
    else:
        print('醒醒醒醒,再给你一次机会')
        continue
print(dic)

 

3. 念数字.  给出一个字典. 在字典中标识出每个数字的发音. 包括相关符号. 然后由用户输入一个数字. 让程序读出相对应的发音(不需要语音输出. 单纯的打印即可)

dic={'-':'fu','1':'yi','2':'er','3':'san','4':'si','5':'wu','6':'liu','7':'qi','8':'ba','9':'jiu','.':'dian','':'shi','':'bai','':'qian','':'wan'}
n=input('请输入一个数字: ')
if "." in str(n):
    n1=n.find(".")
    for c in str(n):
        print(dic[c])
else:
    for c in str(n):
        print(dic[c])

 

    

4. 车牌区域划分, 现给出以下车牌. 根据车牌的信息, 分析出各省的车牌持有量.

lst=[]
dic={}
for c in cars :
    lst.append(locals[c[0]])
    for c in lst:
        dic[c]=lst.count(c)
print(dic)

 

5. 干掉主播. 现有如下主播收益信息, 按照要求, 完成相应操作:

zhubo={'卢本伟':10000,'冯提莫':10000,'金老板':11111,"吴老板":12222,'alex':1}
mon=0
for k,v in zhubo.items():
    mon=mon+int(zhubo[k])
print(mon)
zhubo={'卢本伟':10000,'冯提莫':10000,'金老板':11111,"吴老板":12222,'alex':1}
mon=0
for k,v in zhubo.items():
    mon=mon+int(zhubo[k])
mon=int(mon)
if int(zhubo[k])<mon/len(zhubo):
    del zhubo[k]
print(mon)
print(zhubo)
zhubo={'卢本伟':10000,'冯提莫':10000,'金老板':11111,"吴老板":12222,'alex':1}
del zhubo['卢本伟']
print(zhubo)

 

 

今日默写:

            == 和is的区别

            Unicode,gbk,utf-8的转化。

猜你喜欢

转载自www.cnblogs.com/zhoushibin-1/p/9621134.html