li_01= [11,22,33]
li_02= [22,33,44]
for iin li_01:
if iin li_02:
print(i)
计算不重复组合
li= [1,2,3,4,5,6,7,8]
su= []
count= 0
for iin li:
for oin li:
if i!= o:
v= i,o
su.append(v)
count+= 1
else:
pass
print(su)
print(count)
六位数密码字母数字有多少种组合
count= 0
li= ['a','b','c','d','e''f','g','h','i','j','k','l','m','n','o','p','q','r''s','t','u','v','w''x','y','z','1','2','3','4','5','6','7','8','9','0']
# su = []
for nu_1in li:
for nu_2in li:
for nu_3in li:
for nu_4in li:
for nu_5in li:
for nu_6in li:
# v = nu_1+nu_2+nu_3+nu_4+nu_5+nu_6
# su.append(v)
count+= 1
# print(su)
print(count)
区分数据
li= [11,22,33,44,55,66,77,88,99]
dic= {
'k1':0,
'k2':0
}
li_less= []
li_more= []
for iin li:
if i< 66:
li_less.append(i)
else:
li_more.append(i)
dic.update(k1 = li_less,k2 = li_more)
print(dic)
商品查询增加
li= ['电动亚当','充气夏娃','硅胶莉莉丝']
s= input('输入序列号或添加商品名')
# print(li[s])
if s== int :
print(li[s])
else:
li.append(s)
print(li)
li= ['1','2','3','4','5','6','7','8','9','0']
s= ''
count= 0
for iin li:
for i2in li:
for i3in li:
if i!= i2and i!= i3and i2!= i3:
count+= 1
print(i+i2+i3)
print('计数:',count)
计算提成
le= [1000000,500000,200000,100000,0]
pe= [0.01,0.025,0.05,0.075,0.1]
su= 0
ear= int(input('利润'))
for iin range(0,5):
if ear> le[i]:
su+= (ear-le[i])* pe[i]
ear= le[i]
print(su)
网友评论