Commit d3f735d5 by BellCodeEditor

save project

parent 87be3438
list_hero=['赵一',30,'丁二',37,'孙五',52,'王猛',89,'周亮',98]
dict_hero = {'赵一':30,'丁二':37,'孙五':52,'王猛':89,'周亮':98}
print(len(list_hero))
print(len(dict_hero))
\ No newline at end of file
dict={"百事可乐":3,"果冻":1,"巧克力":2}
k=input("您想买什么呀?")
if k in dict:
print("叮咚~好的"+k+"需要花"+str(dict[k])+"元")
else:
print("抱歉,没有您想要的东西,敬请期待")
\ No newline at end of file
dict_monkey={"猴三":30,"后羿":60,"猴队长":100,"猴五":80}
print(dict_monkey)
dict_monkey["猴队长"]=30
print(dict_monkey)
\ No newline at end of file
name=input('你叫啥名啊?')
power=int(input('你臂力多少啊?'))
list_hero=['猴三',10,'猴一',21,'猴五',22,'猴队长',29,'猴七',30]
for i in range(len(list_hero)):
if i%2==1 and list_hero[i]>=power:
list_hero.insert(i-1,name)
list_hero.insert(i,power)
break
print(list_hero)
# 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典
dict_hero=
print(dict_hero)
\ No newline at end of file
import random
# 私钥
key = "abcdefgh使用编程实现位移替换加密,制作密码机关真是太好玩了哈哈!"
# 要加密语句
message =input("请输入:")
# 加密后的语句(密文)
key_message = ""
noise="$%^*&^@#^&*##&%$!"
# 加密过程
for i in message:
str1 = i
str2 = random.choice(key)
str3 = random.choice(key)
text = str1+str2+str3
key_message = key_message + text
index=random.randint(0,len(key_message))
list_message=list(key_message)
list_message.insert(index,noise)
result_message="".join(list_message)
print(result_message)
\ No newline at end of file
dict_monkey={"猴三":30,"后羿":60,"猴队长":100,"猴五":80}
print(dict_monkey)
dict_monkey["猴队长"]=30
print(dict_monkey)
\ No newline at end of file
dict={"百事可乐":3,"果冻":1,"巧克力":2}
k=input("您想买什么呀?")
if k in dict:
print("叮咚~好的"+k+"需要花"+str(dict[k])+"元")
else:
print("抱歉,没有您想要的东西,敬请期待")
\ No newline at end of file
# 神奇百货中的物品已经帮你创建好啦,接下来要看你的了~
dict= {'可口可乐':3,'旺仔牛奶':4,'农夫山泉':1,'辣条':3,'巴西烤肉':2,'果冻':4,'乐事':5,'奥利奥':10,'巧克力':6}
dict["千层蛋糕"]=28
print(dict)
dict.pop("可口可乐")
print(dict)
k=input('你想买什么呀?')
if k in dict:
print('叮咚~您的'+k+'需要支付'+str(dict[k])+'元~')
else:
print('神奇百货暂未有你想要的物品,敬请期待~')
score={"小明":77,"小王":99,"小美":100}
k=input("请输入你的名字:")
i=input("请输入你的成绩:")
if k in score:
if int(i)>score(k):
score[k]=int(i)
print(k+"同学的成绩已经被更新")
else:
print(k+"同学的名字没有被更新")
else:
score[k]=int(i)
print(k+"同学的第一次成绩"+i+"已被上传" )
\ No newline at end of file
# 这是悟空为花果山小猴做臂力测试的程序代码
name=input('你叫啥名啊?')
power=int(input('你臂力多少啊?'))
list_hero=['猴三',10,'猴一',21,'猴五',22,'猴队长',29,'猴七',30]
for i in range(len(list_hero)):
if i%2==1 and list_hero[i]>=power:
list_hero.insert(i-1,name)
list_hero.insert(i,power)
break
print(list_hero)
# 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典
dict_hero=
print(dict_hero)
# 这是悟空为花果山小猴做臂力测试的程序代码
name=input('你叫啥名啊?')
power=int(input('你臂力多少啊?'))
list_hero=['猴三',10,'猴一',21,'猴五',22,'猴队长',29,'猴七',30]
for i in range(len(list_hero)):
if i%2==1 and list_hero[i]>=power:
list_hero.insert(i-1,name)
list_hero.insert(i,power)
break
print(list_hero)
# 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典
dict_hero={'猴三',10,'猴一',21,'猴五',22,'猴队长',29,'猴七',30}
dict_hero.[]
print(dict_hero)
# 直接运行以下代码,说说你的发现:
list_hero=['赵一',30,'丁二',37,'孙五',52,'王猛',89,'周亮',98]
dict_hero = {'赵一':30,'丁二':37,'孙五':52,'王猛':89,'周亮':98}
print(len(list_hero))
print(len(dict_hero))
\ 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