-
日期的转换 x=input("输入日期")
date = {1:'January',2:'February',3:'March',4:'April',5:'May',6:'June',7:'July',8:'August',9:'September',10:'October',11:'November',12:'December'}
k = x.split('/')
m = date.get(int(k[1]))
y = m+' '+k[2]+','+k[0]
z = k[2]+' '+m+','+k[0]
print("美式格式"+y)
print("英式格式"+z)
-
计算购买饮品金额 cp=(("悠哉悠哉",18),("人间烟火",17),("蔓越阑珊",17),("抹茶葡提",16),("幽兰拿铁",16),(" 翠翠 ",13),("浮生半日",15),("筝筝纸鸢",16),("声声乌龙",15),("风栖绿桂",12),("素颜锡兰",13),("烟火易冷",15))
k = 1
c = 0
for i in range(len(cp)):
if k<10:
z = ' '+str(k)
else:
z = str(k)
for j in range(len(cp[0])):
z += str(cp[i][j])
print(z)
k += 1
while True:
a = int(input("请选择饮品"))
if a == 0:
break
b = int(input("请输入数量"))
c += cp[a-1][1]*b
print("应付"+str(c)+"元")
-
判断句子是否每个英文字母起码出现一次 x=input("")
a = set(x)
b = set('QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm')
c = a&b
if len(c)>=24:
print('True')
else:
print('False')
-
集合的运算 hd1=set()
hd2=set()
gh=input("")
lb=gh.split(',')
for x in lb:
hd1.add(eval(x))
gh=input("")
lb=gh.split(',')
for x in lb:
hd2.add(eval(x))
hd3 = hd1&hd2
hd4 = hd1-hd2
hd5 = hd2-hd1
print("两项活动都参加",hd3)
print("只参加活动1",hd4)
print("只参加活动2",hd5)
|