Commit 41f4d963 by BellCodeEditor

auto save

parent b0335891
Showing with 66 additions and 2 deletions
# for y in range(1,10):
# for i in range(1,y+1):
# print("%d * %d = %d"%(i,y,i*y),end='')
# print(' ')
print("0-100之间的偶数有:")
for y in range(1,101):
if y%2==0:
print("%d"%y)
...@@ -8,4 +8,20 @@ class Hero: ...@@ -8,4 +8,20 @@ class Hero:
# self.level+=1 # self.level+=1
# self.hp+=100 # self.hp+=100
# self.attack+=100 # self.attack+=100
yase=Hero("亚瑟")
\ No newline at end of file def combat(self,enemy):
enemy.hp-=self.attack
info1=self.name+"对"+enemy.name+'发起进攻,'
info2='造成'+str(self.attack)+'点伤害,'
if enemy.hp>0:
info3=enemy.name+'还剩下'+str(enemy.hp)+'血量'
info=info1+info2+info3
print(info)
else:
info3=enemy.name+'阵亡,游戏结束'
info=info1+info2+info3
print(info)
exit()
yase=Hero('亚瑟')
houyi=Hero('后羿')
yase.combat(houyi)
\ No newline at end of file
# a=float(input("请输入体重"))
# b=float(input("请输入身高"))
# BML=a/(b*b)
# if BML<=18.4:
# print("偏瘦")
# elif 23.9>BML>18.5:
# print("正常")
# elif 24.0>BML>27.9:
# print("过重")
# elif BML>=28.0:
# print("肥胖")
num=50
a=int(input("请输入1~100的整数"))
if a==num:
print("恭喜你,猜对了。")
elif a>num:
print("猜大了")
elif a<num:
print("猜小了")
input()
\ 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