Commit 2fb317b0 by BellCodeEditor

save project

parent 4e4d8dba
total = {'qc':{'jyt':20,'mb':20,'sh':30},
't':{'ymnt':15,'sct':15,'hdt':10},
'tp':{'ts':10,'dg':30,'mkl':50}}
for k,v in total.items():
print('今日'+k+'有')
for i in v:
print(i,end='')
print()
\ No newline at end of file
def abc():
total = []
while True:
acb = input('请输入(q退出):')
if acb == 'q':
break
else:
try:
acb=int(acb)
except:
print('请输入数字')
total.append(acb)
print('**************************************')
print(total)
return total
def sum(money):
count=0
for i in money:
count +=i
return count
print(count)
\ No newline at end of file
scores={'y':89,'s':95,'y':90}
def get_average(scores):
sum_score=0
for k,v in scores.items():
sum_score +=v
ave_score=sum_score/len(scores)
print('平均分'+str(ave_score))
get_average(scores)
import turtle
pen=turtle.Pen()
colors=['red','green','yellow','blue']
for i in range(1,500):
pen.forward(i)
pen.pencolor(colors[i%4])
pen.right(91)
pen.hideturtle()
turtle.done()
\ No newline at end of file
i = 3
username = "python" # 保存在服务器数据库中的用户账号(正确的账号)
userpassword = "123456" # 保存在服务器数据库中的用户密码(正确的密码)
while True
while True:
if i>0:
# 请用input()实现用户输入账号、密码的功能
username1=input('请输入账号')
userpassword1=input('请输入密码')
# 如果用户输入的账号、密码正确,提示登陆成功
if username==username1 and userpassword==userpassword1:
print('登录成功')
break
if username != username1
print('用户名错误!')
if userpassword!=userpassword1:
print('密码错误')
username1=input('请输入账号')
userpassword1=input('请输入密码')
i-=1
# 如果用户输入的账号、密码正确,提示登陆成功
if username==username1 and userpassword==userpassword1:
print("登录成功")
break
elif username != username1:
print("用户名错误!")
else:
print("密码错误")
else:
print("账号已锁定")
exit()
print('欢迎来到王者荣耀')
\ No newline at end of file
for i in range(1,10):
for j in range(1,i+1):
print(j,'x',i,'=',(j*i),end=' ')
print()
\ No newline at end of file
bros = ['刘备','关羽','张飞']
bros.pop(1)
bros.remove('张飞')
print(bros)
# print(bros[0])
# for i in range(3):
# print(bros[i],end=' ')
# bros[0] = '关羽'
# bros[1] = '刘备'
# print(bros)
\ No newline at end of file
# b=['袁术','夏侯惇','曹操','关羽']
# print(b[1:3])
# print(b[:])
# print(b[:])
# print(b[:])
#ctrl+/注释
hero=['赵一',30,'丁二',37,'孙五',52,'王猛',89,'周亮',98,'张宇',100]
name='李四'
power=95
for i in range(len(hero)):
if i%2==1 and hero[i]>power:
hero.insert(i-1,name)
hero.insert(i,power)
break
print(hero)
\ No newline at end of file
messare='你好,一起开黑'
lenght = len(messare)
i=0
while i<lenght:
element =messare[i]
print(element)
i+=1
\ No newline at end of file
import random
key = 'dsfjunoiwgjoksalfjioiwejglijsiojgoijijsgdbiknsaw'
message = '外币巴布'
noise = 'ndvuhiudshfgiuehwi'
key_message = ''
for i in key:
str1 = i
str2 = random.choice(key)
str3 = random.choice(key)
key_message=str1+str2+str3+message
list_message = list(key_message)
list_message.insert(5,noise)
rest_message = ''.join(list_message)
print(rest_message)
# dict1 = {'刘':1,'关':2,'张':3}
# print(dict1)
# a = {'yi':1,'er':2,'san':3}
# for i,j in a.items():
# print(i,j)
xs1 = {'yw':84.5,'sx':93,'yy':95.5,}
xs2 = {'yw':90,'sx':95,'yy':80}
score = {'a':xs1,'b':xs2,}
name = input('name')
print('*'*50)
if name in score:
info = score[name]
for i,k in info.items():
print(i,k)
else:
print('姓名不存在')
#
a = {'b':2,'c':3,'d':4,'e':5,}
a.pop('c')
print(a)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment