Commit 6871eb3e by BellCodeEditor

auto save

parent 4bbb8e62
Pipeline #6486 failed in 0 seconds
# 假期到了,诺依想出去玩,但不知道有没有飞机直达那里,
# 悟空做了个小程序帮助诺依,然而代码出现了3处错误。
# 请你找出来,并运行~
city = ['纽约','华盛顿','桃源岛','洛杉矶','芝加哥','旧金山']
wwwwww=input('你想去哪里啊?')
if wwwwww in city:
print('可以乘坐飞机通往'+wwwwww)
else:
print('没有'+wwwwww+'这座城市')
\ No newline at end of file
# 下面的这段代码一共有5处错误,每一行都有一种典型的语法错误,请修改~
for i in range(1,8):
print('克洛诺斯将第' + str(i) + '个孩子吞进肚子里')
if i == 5:
break
print('第6个孩子宙斯逃过一劫。')
\ No newline at end of file
new_data=''
with open(r'C:\Users\Administrator\Desktop\1.txt','r',encoding='utf-8') as file1:
for data in file1:
if '小强:10本' in data:
data=data.replace('小强:10本','小强:11本')
if '小兰:12本'in data:
data=data.replace('小兰:12本','小兰:14本')
new_data+=data
with open(r'C:\Users\Administrator\Desktop\1.txt','w',encoding='utf-8') as file1:
file1.write(new_data)
with open(r'C:\Users\Administrator\Desktop\1.txt','r',encoding='utf-8') as file1:
a=file1.read()
print(a)
\ No newline at end of file
# 下面的这段代码一共有5处错误,每一行都有一种典型的语法错误,请修改~
for i in range(1,8):
print('克洛诺斯将第' + str(i) + '个孩子吞进肚子里')
if i == 5:
break
print('第6个孩子宙斯逃过一劫。')
\ No newline at end of file
`
\ No newline at end of file
(r'C:\Users\Administrator\Desktop\1.txt','r',encoding='utf-8')
\ No newline at end of file
# 假期到了,诺依想出去玩,但不知道有没有飞机直达那里,
# 悟空做了个小程序帮助诺依,然而代码出现了3处错误。
# 请你找出来,并运行~
city = ['纽约','华盛顿','桃源岛','洛杉矶','芝加哥','旧金山']
area=input('你想去哪里啊?')
if area in city:
print('可以乘坐飞机通往'+area)
else:
print('没有'+area+'这座城市')
\ No newline at end of file
with open(r'C:\Users\Administrator\Desktop\1.txt','r',encoding='utf-8') as file1:
\ No newline at end of file
# 灭霸打了一个响指,宇宙一半生物都灰飞烟灭。
# 剩下的复仇者联盟成员们依旧没有放弃反击灭霸的机会,他们决定利用最后一次行动机会,去把灭霸手里的宝石偷回来。
# 如果偷回的宝石数是4颗及以上,便获得了打败灭霸的力量;如果偷回的宝石数是1-3颗,他们可以全员出动,殊死一搏;如果偷回的宝石数是0颗,只能尝试呼叫惊奇队长。
# 最终,他们因为实力相差太大,1颗宝石都没有偷回来。
# 悟空读了上面的故事,写出一段代码,在一颗宝石都没偷回来的赋值下,进行条件判断,并产生对应的结果:
# 如果偷回的宝石数是4颗及以上,输出结果:获得了打败灭霸的力量,反杀稳了
# 如果偷回的宝石数是1-3颗,输出结果:可以全员出动,殊死一搏
# 如果偷回的宝石数是0颗,输出结果:没办法了,只能尝试呼叫惊奇队长
# 但是运行错误了,请你帮助悟空消灭bug!
stonenumber=1
if stonenumber >= 4:
print('获得了打败灭霸的力量,反杀稳了')
elif 1<=stonenumber <= 3:
print('可以全员出动,殊死一搏')
else:
print('没办法了,只能尝试呼叫惊奇队长')
# 灭霸打了一个响指,宇宙一半生物都灰飞烟灭。
# 剩下的复仇者联盟成员们依旧没有放弃反击灭霸的机会,他们决定利用最后一次行动机会,去把灭霸手里的宝石偷回来。
# 如果偷回的宝石数是4颗及以上,便获得了打败灭霸的力量;如果偷回的宝石数是1-3颗,他们可以全员出动,殊死一搏;如果偷回的宝石数是0颗,只能尝试呼叫惊奇队长。
# 最终,他们因为实力相差太大,1颗宝石都没有偷回来。
# 悟空读了上面的故事,写出一段代码,在一颗宝石都没偷回来的赋值下,进行条件判断,并产生对应的结果:
# 如果偷回的宝石数是4颗及以上,输出结果:获得了打败灭霸的力量,反杀稳了
# 如果偷回的宝石数是1-3颗,输出结果:可以全员出动,殊死一搏
# 如果偷回的宝石数是0颗,输出结果:没办法了,只能尝试呼叫惊奇队长
# 但是运行错误了,请你帮助悟空消灭bug!
stonenumber=4
if stonenumber >= 4:
print('获得了打败灭霸的力量,反杀稳了')
elif 1<=stonenumber <= 3:
print('可以全员出动,殊死一搏')
else:
print('没办法了,只能尝试呼叫惊奇队长')
def new_input():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
else:
try:
unit=int(unit)
except:
print("请重新输入一个数字")
else:
total.append(unit)
print('-'*30)
print(total)
new_input()
def sum(money):
count=0
for i in money:
count= count+i
return count
print=new_input()
pay=sum(price)
print("你有共消费了"+str(pay)+'元!扫码还是现金')
\ No newline at end of file
def new_input():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
else:
try:
unit=int(unit)
except:
print('请重输一个数字')
else:
total.append(unit)
print('='*50)
print(total)
new_input()
\ No newline at end of file
import random
# 私钥
key = "abcdefgh使用编程实现位移替换加密,制作密码机关真是太好玩了哈哈!"
# 要加密语句
message = "诺依,周末一起去看动漫展吧!"
# 加密后的语句(密文)
key_message = ""
# 加密过程
for i in message:
str1 = i
str2 = random.choice(key)
str3 = random.choice(key)
text = str1+str2+str3
key_message = key_message + text
print(key_message)
file1=open(r"C:\Users\Administrator\Desktop\1.txt",'a',encoding='utf-8')
file1.write('RPG:12发子弹\n')
file1.close()
with open(r"C:\Users\Administrator\Desktop\1.txt",'a',encoding='utf-8') as file1:
file1.write('RPG:错所炸了......\n')
\ No newline at end of file
student1={'语文':90000000,'数学':10000000,'英语':850000009}
student2={'语文':90000000000,'数学':1000000000000000000000,'英语':899990000009}
student3={'语文':900000000009999,'数学':10000000000000000000009999,'英语':8999900000099999}
score={'悟空':student1,'诺伊':student2,'小八':student3}
name=input("名字:")
print('*'*30)
if name in score:
info=score[name]
for k,v in score.items():
print(k,v)
print("*"*30)
else:
print("查询错误,请输入正确的名字!:")
\ No newline at end of file
import random
# 私钥
key = "abcdefgh使用python实现简单的位移替换加密,制作密码机关真是太好玩了哈哈哈!"
# 要加密语句
message = input("请输入:")
# 最终加密后的语句
key_message = ""
# 干扰字符
noise = "port:@#$%^&"
for i in message:
str1 = i
str2 = random.choice(key)
str3 = random.choice(key)
text = str1+str2+str3
key_message = key_message + text
list_message = list(key_message)
index = random.randint(0, len(key_message))
list_message.insert(index, noise)
result_message = "".join(list_message)
print(result_message)
\ No newline at end of file
dict_hero={'猴三':10,'猴一':21,'猴五':22,'猴队长':29,'猴七':30}
print(dict_hero)
print(dict_hero['猴队长'])
dict_hero['猴七']=32
print(dict_hero)
dict_hero['诺亚']=999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
print(dict_hero)
\ No newline at end of file
score={'语文':90000000,'数学':10000000,'英语':85000000}
for k,v in score.items():
print(k,v)
\ No newline at end of file
import random
# 私钥
key = "abcdefgh使用编程实现位移替换加密,制作密码机关真是太好玩了哈哈!"
# 要加密语句
message=input("请输入:")
# 加密后的语句(密文)
key_message = ""
noist = 'vgbfyfvkshbfgdhbvfgvhfeueeuueueueuuee'
# 加密过程
for i in message:
str1 = i
str2 = random.choice(key)
str3 = random.choice(key)
text = str1+str2+str3
key_message = key_message + text
list_message=list(key_message)
index =random.randint(0,len(key_message))
list_message.insert(index,noise)
result_message=''.join(list_message)
print(result_message)
dict_hero={'猴三':10,'猴一':21,'猴五':22,'猴队长':29,'猴七':30}
print(dict_hero)
print(dict_hero['猴队长'])
dict_hero['猴七']=32
print(dict_hero)
dict_hero['猴十']=25
print(dict_hero)
\ No newline at end of file
dict={'可口可乐':999999999999999999999,'旺仔牛奶':567890,'农夫山泉':1,'辣条':99999999999999999999}
k=input('你想买什么')
if k in dict:
print('叮咚您的'+k+'要支付'+str(dict[k])+'元')
else:
print("没货了")
\ No newline at end of file
dict={'可口可乐':3,'袜仔牛奶':4,'农夫山泉':1}
k=input('想买啥子嘞')
if k in dict:
print('叮咚-您的'+k+'应付'
+str(dict[k])+'元')
else:
print('主店货没有,去分店买')
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