Commit 1225b027 by BellCodeEditor

save project

parent b475275a
Showing with 47 additions and 4 deletions
......@@ -2,7 +2,29 @@
#ssj1=open('C:\\Users\\玛酷机器人\\Desktop\\test.txt','w',encoding='utf-8')
#ssj1.write('小兰:12本、小丽:11本、李文:9本、张伟:16本、')
#ssj1.close()
with open('C:\\Users\\玛酷机器人\\Desktop\\test.txt','r',encoding='utf-8')as ssj1:
for data in ssj1:
if'小强:10本'in data:
print('数据在文件中')
# with open('C:\\Users\\玛酷机器人\\Desktop\\test.txt','r',encoding='utf-8')as ssj1:
# for data in ssj1:
# if'小强:10本'in data:
# print('数据在文件中')
# if'小兰:12本'in data:
# print('数据在文件中')
# import random
# a=random.randint(0,100)
# if a>90:
# print('A')
# elif a>80:
# print('B')
# elif a>70:
# print('D')
# else:
# print('D')
# a=[3,4,9,13]
# b=[i for i in a if i<=5]
# print(b)
import random
a=int(input('请输入一个数:'))
if a%2==0:
print('no')
else:
print('yes')
class Hero:
def __init__(self,name):
self.level=1
self.hp=250
self.attack=40
self.name=name
def combat(self,enemy):
enemy.hp-=self.attack
info1 = self.name+"对"enemy.name+"发起进攻,"
info2 = "造成"+str(self.attack)+"点伤害,"
if enemy.hp>0
info3 = enemy.name+"还剩下"+srt(enemy.hp)+"血量"
info = info1 + info2 + info3
print(info)
else:
info3 = enemy.name+"阵亡,游戏结束"
info = info1 + info2 + info3
print(info)
exit()
\ 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