04代码

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=["A","B","C","D"]

new=["E","F","G"]

oldlist.extend(new)

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("你好,欢迎光临~cr咖啡馆~\n\n我店有:\n")

for name in coffeename:

print(name+"咖啡",end=" ")

 

 

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=coffeename+('拿铁',)

print(coffeename)

 

name=['crz','pxy','gyl','zby']

num=[24,21,1,2]

list=dict(zip(name,num))

print(list)

 

 

name=['crz','pxy','gyl','zby','gzz']

sign_person=['金牛座','处女座','巨蟹座','水瓶座','摩羯座']

person_dict=dict(zip(name,sign_person))

sign_all=['白羊座','金牛座','双子座','巨蟹座','狮子座','处女座','天秤座','天蝎座','摩羯座','水瓶座','双鱼座']

nature=['直','保守','新鲜感','敏感','完美主义者','追求平等','占有欲强','崇尚自由','有耐心','创新','集所有星座的优缺点于一身']

sign_dict=dict(zip(sign_all,nature))

print("crz的星座是",person_dict.get('crz'))

print("\n 他的性格特点是: \n\n",sign_dict.get(person_dict.get('crz')))

 

name=['crz','gyl','zby','pxy','gzz']

sign=['金牛','巨蟹','水瓶','处女','摩羯']

dict={i:j+'座' for i,j in zip(name,sign)}

print(dict)

 

python={'crz','pxy'}

c={'gyl','zby'}

print("选择Python的学生有:",python,'\n')

print("选择c的同学有:",c,'\n')

 

 

python=set(['pxy','gyl','zby','gzz'])

python.add('crz')

c=set(['crz','pxy','gyl','zby','gzz'])

c.remove('crz')

print("选择Python的学生有:",python,'\n')

print("选择c的同学有:",c,'\n')

 

python=set(['pxy','gyl','zby'])

c=set(['crz','pxy','gyl','zby','gzz'])

print("选择Python的学生有:",python,'\n')

print("选择c的同学有:",c,'\n')

print("交集运算:",python & c)

print("并集运算",python | c)

print("差集运算",c-python)

 

 

实战1

print("“王者荣耀”游戏角色:")

print("-------坦克--------")

a=['苏烈','刘邦','钟馗','张飞','牛魔','程咬金','白起','刘禅','庄周','项羽','廉颇','巨灵神','安禄山','猪八戒']

print(a)

print("========战士=========")

b=['狂铁','裴擒虎','铠','孙悟空','哪吒','杨戟','橘右京','亚瑟','雅典娜','夏侯惇','关羽','吕布']

print(b)

print("======刺客======")

c=['百里玄策','庞统','花木兰','荆轲','不知火舞','李白','娜可露露','兰陵王']

print(c)

print("=====法师=======")

d=['杨玉环','弈星','女娲','周瑜','鬼谷子','芈月','干将莫邪','东皇太一','大乔','诸葛亮','貂蝉']

print(d)

print("========射手======")

e=['公孙离','百里守约','后羿','刘备','黄忠','马可波罗','成吉思汗','虞姬','李元芳']

for item in e:

    print(item)

print("======辅助======")

f=['明世隐','梦奇','孙膑','太乙真人','蔡文姬']

for index,item in enumerate(f):

    print(index,item)

 

listname=[['车次','出发站-到达站','出发时间','到达时间','历时'],

          ['T40',' 长春-北京','    00:12','  12:20',' 12:08'],

          ['T298','长春-北京','    00:06','  10:50',' 10:44'],

          ['Z158','长春-北京','    12:48','  21:06',' 08:18'],

          ['Z62',' 长春-北京','    21:58','  06:08',' 08:20']]

for i in range(5):

    for j in range(5):

        if j==4:

            print(listname[i][j],end='     \n')

        else:

            print(listname[i][j],end='         ')

dictionary={'T40':'00:12','T298':'00:06','Z158':'12:48','Z62':'21:58'}

b=input('请输入要购买的车次:')

a=input("请输入乘车人(用逗号分隔):")

print("你已购",b,"次列车 长春-北京 ",dictionary[b],"开,请",a,"尽快换取纸质车票。【铁路客服】")

 

print("电视剧的收视率排行榜:")

a=['《give up 》','《husbands》','《My father in law 》',

   '《North Canton》','《Impossible》','《Sparrow》','《East》',

   '《The prodigal》','《Music》','《distant》']

b=[1.4,1.343,0.92,0.862,0.553,0.411,0.164,0.259,0.394,0.562]

c=dict(zip(b,a))

b_as=sorted(b,reverse=True)

d=len(a)

for i in range(d):

    e=float(b_as[i])

    print(c[e],'\t','收视率为:',e,'%')

 

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

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

      1.0分钟

      2.50分钟

      3.100分钟

      4.300分钟

      5.不限量''')

a_a={'1':'0分钟','2':'50分钟','3':'100分钟','4':'300分钟','5':'不限量'}

a=input('输入选择的通话时长:')

print('''B.请设置流量包:

      1.0M

      2.500M

      3.1G

      4.5G

      5.不限量''')

b=input('输入选择的流量包:')

b_b={'1':'0M','2':'500M','3':'1G','4':'5G','5':'不限量'}

print('''C.请设置短信条数

      1.0条

      2.50条

      3.100条''')

c=input('输入选择的短信条数:')

c_c={'1':'0条','2':'50条','3':'100条'}

print('您的手机套餐定制成功:免费通话时长为',a_a[a],'流量为',b_b[b],'短信条数',c_c[c])

 

posted @ 2022-09-24 23:06  crz~~  阅读(44)  评论(0编辑  收藏  举报