lhxx

 

第三周python作业

import datetime
mot = ["今天星期一:\n坚持下去不是因为我很坚强,而是因为我别无选择。",
     "今天星期二:\n含泪播种的人一定会笑着收。",
     "今天星期三: \n做对的事情比把事情做对更重要。",
     "今天星期四:\n命运给予我们的不是失望之酒,而是希望之杯。",
     "今天星期五:\n不要等到明天,明天太遥远,今天就行动。",
     "今天星期六:\n求知若饥,虚心若愚。",
     "今天星期日:\n成功将属于那些从不说“不可能”的人。"]
day=datetime.datetime.now().weekday()
print(mot[day])

 

 

 

print("2017-2018赛季NBA西部联盟前八名\n")
team = ["火箭","勇士","开拓者","雷霆","爵士","鹈鹕","马刺","森林狼"]
for index,item in enumerate(team):
    if index%2 == 0:
        print(item +"\t\t",end='')
    else:
        print(item +"\n")

 

 

 

oldlist = ["迈克尔 乔丹","卡里尔 阿布杜尔 贾巴尔","哈基姆 奥拉朱旺","查尔斯 巴克利","姚明"]
newlist = ["贾森 基德","史蒂夫 纳什","格兰特 希尔"]
oldlist.extend(newlist)
print(oldlist)

 

 

 

str1="千山鸟飞绝"
str2="万径人踪灭"
str3="孤舟蓑笠翁"
str4="独钓寒江雪"
verse = [list(str1),list(str2),list(str3),list(str4)]
print("\n--横板--\n")
for i in range(4):
    for j in range(5):
        if j==4:
            print(verse[i][j])
        else:
                print(verse[i][j],end="")
verse.reverse()
print("\n--竖版--\n")
for i in range(5):
    for j in range(4):
        if j==3:
            print(verse[j][i])
        else:
            print(verse[j][i],end="")

 

 

 

 

 

 

coffeename = ('蓝山','卡布奇诺','曼特宁','摩卡','麝香猫','哥伦比亚')
print(coffeename)

 

 

 

coffeename = ('蓝山','卡布奇诺','曼特宁','摩卡','麝香猫','哥伦比亚')
print("您好,欢迎光临~伊米咖啡馆~\n我店有:")
for name in coffeename:
    print(name +"咖啡",end=" ")

TV = [
    ('《Give up,hold on to me》', 1.4),
    ('《The private dishes of the husbands》', 1.343),
    ('《My father-in-law will do martiaiarts》', 0.92),
    ('《North Canton still believe in love》', 0.862),
    ('《Impossible task》', 0.553),
    ('《Sparrow》', 0.411),
    ('《East of dream Avenue》', 0.164),
    ('《The prodigal son of the new frontier town》', 0.259),
    ('《Distant distance》', 0.394),
    ('《Music legend》', 0.562)
]

TV = sorted(TV, key=lambda s: s[1], reverse=True)
for tv in TV:
    print(tv[0] + '收视率:' + str(tv[1]) + '%')

 

 

 

 

print("2017~2018赛季NBA西部联盟前八名\n")
team = ("火箭","勇士","开拓者","雷霆","爵士","鹈鹕","马刺","森林狼")
for index,item in enumerate(team):
    if index%2==0:
        print(item + "\t\t",end="")
    else:
        print(item+"\n")

 

 

coffeename = ('蓝山','卡布奇诺','曼特宁','摩卡','麝香猫','哥伦比亚')
coffeename = (蓝山','卡布奇诺','曼特宁','摩卡','拿铁','哥伦比亚')
print("新元组"coffeename)

 

 

name = ['绮梦','冷伊一','香凝','黛兰']
sign = ['水瓶座','射手座','双鱼座','双子座']
dictionary=dict(zip(name,sign))
print(dictionary)

 

 

name = ['绮梦','冷伊一','香凝','黛兰']
sign_person = ['水瓶座','射手座','双鱼座','双子座']
person_dict = dict(zip(name,sign_person))
sign_all =['白羊座','金牛座','双子座','巨蟹座','狮子座','处女座','天秤座',
           '天蝎座','射手座','摩羯座','水瓶座','双鱼座']
nature = ['有一种让人看见就觉得开心的感觉,阳光、乐观、坚强,性格直来直去,就是有点小脾气。',
          '很保守,喜欢稳定,一旦有什么变动就会觉得心里不踏实,性格比较慢热,是个理财高手。',
          '喜欢追求新鲜感,有点小聪明,耐心不够,因你的可爱性格会让很多人喜欢和你做朋友。',
          '情绪容易敏感,缺乏安全感,做事情有坚持到底的毅力,为人重情重义,对朋友和家人特别忠实。',
          '有着远大的理想,总想靠自己的努力成为人上人,总是期待被仰慕被崇拜的感觉。',
          '坚持追求自己的完美主义者。',
          '追求平等、和谐,交际能力强,因此朋友较多。最大的缺点就是面对选择总是犹豫不决。',
          '精力旺盛,占有欲强,对于生活很有目标,不达目的誓不罢休,复仇心重。',
          '崇尚自由,勇敢、果断、独立,身上有一股勇往直前的劲儿,只要想做,就能做。',
          '是最有耐心的,做事最小心。做事脚踏实地,比较固执,不达目的不罢休,而且非常勤奋。',
          '人很聪明,最大的特点是创新,追求独一无二的生活,个人主义色彩很浓重的星座。',
          '集所有星座的优缺点于一身。最大的优点是有颗善良的心, 愿意帮助别人。']
sign_dict = dict(zip(sign_all,nature))
print(" 【香凝】的星座是",person_dict. get("香凝"))
print("\n 她的性格特点是: \n\n",sign_dict.get(person_dict.get("香凝")))

 

 

name = ['绮梦','冷伊一','香凝','黛兰']
sign = ['水瓶座','射手座','双鱼座','双子座']
dictionary = dict(zip(name,sign))
print(dictionary)

 

 

python = {'绮梦','冷伊一','香凝','黛兰'}
C = {'冷伊一','零语','梓轩','圣博'}
print( '选择Python语言的学生有: ',python, '\n')
print( '选择C语言的学生有: ',C)

 

 

python = set(['绮梦','冷伊一','香凝','梓轩'])
C = set(['冷伊一','零语','梓轩','圣博'])
print( '选择Python语言的学生有: ',python, )
print( '选择C语言的学生有: ',C)
print('交集运算:',python & C)
print('并集运算:',python | C)
print('差集运算:',python - C)

 

 

python = set(['绮梦','冷伊一','香凝','梓轩'])
python.add('零语')
C = set(['冷伊一','零语','梓轩','圣博'])
C.remove('零语')
print( '选择Python语言的学生有: ',python, '\n')
print( '选择C语言的学生有: ',C)

 

 

print("“王者荣耀“游戏角色:")
print("====坦克:====")
tank = ["苏烈", "刘邦", "钟馗", "张飞", "牛魔", "程咬金", "白起", "刘禅", "庄周", "项羽", "廉颇", "巨灵神", "安禄山", "猪八戒"]
for i in tank:
    print(i, end=" ")
print("\n"+"====战士:====")

zhanshi = ["狂铁", "裴擒虎", "", "孙悟空", "哪吒", "杨戬", "橘右京", "亚瑟", "雅典娜", "夏侯惇", "关羽", "吕布", "韩信", "老夫子", "达摩",
           "典韦", "曹操", "钟无艳", "墨子", "赵云", "刑天", "龙且"]
for i in zhanshi:
    print(i, end=" ")
print("\n"+"====刺客:====")

cike = ["百里玄策", "庞统", "花木兰", "靳柯", "不知火舞", "李白", "娜可露露", "兰陵王", "韩信", "宫本武藏", "盖聂", "红拂"]
for i in cike:
    print(i, end=" ")
print("\n"+"====法师:====")

fashi = ["杨玉环", "奕星", "女娲", "周瑜", "鬼谷子", "芈月", "东皇太一", "大乔", "诸葛亮", "貂蝉", "张良", "安琪拉"]
for i in fashi:
    print(i, end=" ")
print("\n"+"====射手:====")

sheshou = ["公孙离", "百里守约", "后羿", "刘备", "黄忠", "马可波罗", "成吉思汗", "虞姬", "李元芳", "艾琳", "狄仁杰", "鲁班七号", "孙尚香"]
for i in sheshou:
    print(i, end=" ")
print("\n"+"====辅助:====")

fuzhu = ["明世隐", "梦奇", "孙膑", "太乙真人", "蔡文姬"]
for i in fuzhu:
    print(i, end=" ")

 

 

title = ['车次 ', '出发站-到达站 ', '出发时间 ', '到达时间 ', '历时 ']
num = ['T40', 'T298', 'Z158', 'Z62']
place = ['长春-北京', '长春-北京', '长春-北京', '长春-北京']
start = ['00:12', '00:06', '12:48', '21:57']
final = ['12:20', '10:50', '21:06', '06:08']
time = ['12:08', '10:44', '08:18', '08:20']

print(title[0], ' ', title[1], ' ', title[2], ' ', title[3], ' ', title[4])
print(num[0], '  ', place[0], '     ', start[0], '    ', final[0], '   ', time[0])
print(num[1], ' ', place[1], '     ', start[1], '    ', final[1], '   ', time[1])
print(num[2], ' ', place[2], '     ', start[2], '    ', final[2], '   ', time[2])
print(num[3], '  ', place[3], '     ', start[3], '    ', final[3], '   ', time[3])

m = dict(zip(num, start))
n = dict(zip(num, place))

a = input('请输入要购买的车次:')
b = input('请输入乘车人(用逗号):')

aplace = n[a]
astart = m[a]

print(f'您已购{a}次列车 {aplace} {astart}开, 请{b}尽快换取纸质车票。【铁路客服】')

 

 

TV = [
    ('《Give up,hold on to me》', 1.4),
    ('《The private dishes of the husbands》', 1.343),
    ('《My father-in-law will do martiaiarts》', 0.92),
    ('《North Canton still believe in love》', 0.862),
    ('《Impossible task》', 0.553),
    ('《Sparrow》', 0.411),
    ('《East of dream Avenue》', 0.164),
    ('《The prodigal son of the new frontier town》', 0.259),
    ('《Distant distance》', 0.394),
    ('《Music legend》', 0.562)
]

TV = sorted(TV, key=lambda s: s[1], reverse=True)
for tv in TV:
    print(tv[0] + '收视率:' + str(tv[1]) + '%')

 

 

print("定制自己的手机套餐:")

timer = ["0分钟", "50分钟", "100分钟", "300分钟", "不限量"]

flow = ["0M", "500M", "1G", "不限量"]

message = ["0条", "50条", "100条"]

print("A.请设置通话时长:")

for index,item in enumerate(timer):

    print(str(index + 1) + '.', item)

charges_num = input("输入选择的通话时长编号:")

if charges_num == "1":
    timer_c = timer[0]

if charges_num == "2":
    timer_c = timer[1]

if charges_num == "3":

    timer_c = timer[2]

if charges_num == "4":

     timer_c = timer[3]

if charges_num == "5":

    timer_c = timer[4]

print("B.请设置流量包:")

for index,item in enumerate(flow):

     print(str(index + 1) + '.', item)

flow_num = input("输入选择的流量包编号:")

if flow_num == "1":

    flow_c = flow[0]

if flow_num == "2":

    flow_c = flow[1]

if flow_num == "3":

     flow_c = flow[2]

if flow_num == "4":

    flow_c = flow[3]

print("C.请设置短信条数:")

for index,item in enumerate(message):

    print(str(index + 1) + '.', item)

message_num = input("输入选择的短信条数编号:")

if message_num == "1":

    message_c = message[0]

if message_num == "2":

     message_c = message[1]

if message_num == "3":

    message_c = message[2]

print("您的手机套餐定制成功:免费通话时长为" + timer_c + "/月,流量为" + flow_c + "/月,短信条数" + message_c + "/月")

 

posted on 2022-09-29 13:43  超人超会飞  阅读(38)  评论(0编辑  收藏  举报

导航