Commit dcea2c65 by BellCodeEditor

save project

parent 7c9d3dee
import turtle
len=150
screen=turtle.Screen()
screen.bgcolor("blue")
pen=turtle.Pen()
pen.penup()
pen.goto(100,-100)
pen.write("你好呀!",font=("Times",20,"normal"))
pen.hideturtle()
pen1=turtle.Pen()
pen1.pensize(5)
pen1.pencolor("red")
pen1.left(45)
pen1.forward(len)
pen1.circle(len/2,180)
pen1.right(90)
pen1.circle(len/2,180)
pen1.forward(len)
pen1.hideturtle()
turtle.done()
\ No newline at end of file
class Hero:
def __init__(self,name,hp,attack):
self.level = 3
......
txt = 'wecome to the bellcode'
new_txt = txt.split()
print(new_txt)
txt1 = "阿萨德,颚骨,七点,"
new_txt1 = txt1.split(',')
print(new_txt1)
class Hero:
def __init__(self,name):
self.level=1
self.hp=10000
self.attack=4
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+"还剩下"+str(enemy.hp)+"血量"
info = info1+info2+info3
print(info)
else:
info3 = enemy.name+"阵亡,游戏结束"
info = info1+info2+info3
print(info)
exit()
class C:
def __init__(self):
self.footnum = 4
self.eyenum = 2
self.head = 1
self.earnum = 2
self.skin = "black"
def run(self):
print("小猫飞快地跑起来")
def skill(self,prey):
print("小猫抓住了"+prey)
role = Cat()
role.skill("老鼠")
class Hero:
def __init__(self,name):
self.level=1
self.hp=10000
self.attack=4
self.name = name
def combat(self,enemy):
info1 = self.name+"对"+enemy.name+"发起攻击,"
info2 = "造成" +str(self.attack)+"点伤害,"
enemy.hp -= 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()
class Player(Hero):
def __init__(self,name,hero_type):
super(Player,self).__init__(name)
self.hp=100
self.attack=4
self.hero_type = hero_type
print("角色",self.name+"创建成功,英雄类名为:",self.hero_type)
print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack)
libai = Player("李白","打野")
kai = Hero("凯")
# player = Player("李白")
# print("玩家的血量为:",player.hp)
# print("玩家的攻击力为:",player.attack)
class Hero:
def __init__(self,name,hp,attack):
self.level = 3
self.name = name
self.hp = hp
self.attack = attack
class Player(Hero) :
def __init__(self,name):
self.level=1
self.hp=10000
self.attack=4
self.name = name
player = Player("后裔")
print("玩家的血量为:",player.hp)
print("玩家的攻击力为:",player.attack)
# def combat(self,enemy):
# info1 = self.name+"对"+enemy.name+"发起攻击,"
# info2 = "造成" +str(self.attack)+"点伤害,"
# enemy.hp -= 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()
# libai = Hero("李白")
# kai = Hero("凯")
# libai.combat(kai)
\ No newline at end of file
class Dog:
def __init__(self):
self.footnum = 4
self.eyenum = 2
self.head = 1
self.earnum = 2
self.skin = "white"
def run(self):
print("小猫飞快地跑起来")
class Husky(Dog):
def __init__(self):
super(). __init__()
self.skin = "black"
coco = Husky()
print(coco.skin)
\ No newline at end of file
with open (r'c:\Users\ThinkPad\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as file1:
a = file1.readlines()
# print(a)
final_sum=[]
for i in a:
data = i.split()
sum = 0
for sales in data[1:]:
sum += int(sales)
result = data[0]+str(sum)+"\n"
final_sum.append(result)
#print(result)
with open(r'c:\Users\ThinkPad\Documents\lesson13-1\new_sales_list.txt','w',encoding='utf-8') as file1:
file1.writelines(final_sum)
悟空348
诺依380
小贝182
李丽201
宋扬107
王明245
李强164
孙小白222
苏琪137
刘若若147
刘阳226
王胜男123
王娇131
class Dog:
def __init__(self):
self.footnum = 4
self.eyenum = 2
self.head = 1
self.earnum = 2
self.skin = "white"
def run(self):
print("小猫飞快地跑起来")
class Husky(Dog):
def __init__(self):
super(). __init__()
self.skin = "black"
coco = Husky()
print(coco.skin)
\ No newline at end of file
悟空 12 15 11 12 11 12 13 21 27 12 15 30 22 26 15 12 21 23 27 11
诺依 21 29 15 21 21 21 29 30 12 13 12 12 24 52 27 26 15
小贝 29 11 11 15 13 15 13 11 11 29 13 11
李丽 13 15 20 15 15 11 17 20 20 11 12 12 20
宋扬 11 11 11 11 15 17 11 20
王明 30 27 26 24 29 12 15 11 22 26 23
李强 12 12 11 15 11 13 25 26 11 13 15
孙小白 25 26 12 15 27 30 48 39
苏琪 15 11 15 15 30 13 27 11
刘若若 11 11 13 11 20 15 13 29 24
刘阳 11 15 22 11 23 26 22 15 17 52 12
王胜男 27 15 15 26 13 12 15
王娇 12 11 12 12 15 35 23 11
\ No newline at end of file
class Dog:
def __init__(self):
self.footnum = 4
self.eyenum = 2
self.head = 1
self.earnum = 2
self.skin = "white"
def run(self):
print("小猫飞快地跑起来")
class Husky(Dog):
def __init__(self):
super(). __init__()
self.skin = "black"
coco = Husky()
print(coco.skin)
\ 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