找回密码
 中文实名注册
查看: 201|回复: 5

缪柏毅

[复制链接]

2

主题

24

帖子

2519

积分

金牌会员

Rank: 6Rank: 6

积分
2519
发表于 2022-8-19 19:07:22 | 显示全部楼层 |阅读模式
缪柏毅      
回复

使用道具 举报

2

主题

24

帖子

2519

积分

金牌会员

Rank: 6Rank: 6

积分
2519
 楼主| 发表于 2022-8-19 19:07:55 | 显示全部楼层
[Python] 纯文本查看 复制代码
def count(prite_list):  
    total = sum(prite_list)
    if total >= 200:
        result = total*0.6
    elif total >=100:
        result = total*0.6
    else:
        result = total*0.8
    print(result)
count([54,76,23,90,67,84])
回复

使用道具 举报

2

主题

24

帖子

439

积分

中级会员

Rank: 3Rank: 3

积分
439
发表于 2022-8-20 11:47:53 | 显示全部楼层
张袁宸浩
回复

使用道具 举报

2

主题

24

帖子

2519

积分

金牌会员

Rank: 6Rank: 6

积分
2519
 楼主| 发表于 2022-9-3 12:05:38 | 显示全部楼层

第七单元第二课 类与对象

[Python] 纯文本查看 复制代码
class Car():
    def __init__(self,color,people):
        self.color = color
        self.people = people
        self.position = [400,300]
        self.change_direction = 'ringht'

    def froward(self):
        self.change_direction = 'up'
        self.position[0] +=5

Car_one=Car('blue',2)
print(Car_one.color)
Car_one.forward()

Car_two=Car('blue',2)
Car_one.forward()
回复

使用道具 举报

2

主题

24

帖子

2519

积分

金牌会员

Rank: 6Rank: 6

积分
2519
 楼主| 发表于 2022-9-10 10:51:10 | 显示全部楼层
[Python] 纯文本查看 复制代码
import pygame
import sys


pygame.init()
screen = pygame.display.set_mode((800,600))

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()
    pygame.display.update()
回复

使用道具 举报

2

主题

24

帖子

2519

积分

金牌会员

Rank: 6Rank: 6

积分
2519
 楼主| 发表于 2022-9-10 11:46:26 | 显示全部楼层
[Python] 纯文本查看 复制代码
import pygame
import sys

pygame.init()
screen = pygame.display.set_mode((800, 600))
background = pygame.image.load('image/星海背景.png')
alarm = pygame.image.load('image\警报器.png')
spaceship = pygame.image.load('image\战舰.png')
storage = pygame.image.load('image\反应仓.png')
push = pygame.image.load('image\弹出按钮.png')

site = [100, 100]
while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_UP:
                site[1] -= 8
            if event.key == pygame.K_DOWN:
                site[1] += 8
            if event.key == pygame.K_LEFT:
                site[0] -= 8
            if event.key == pygame.K_RIGHT:
                site[0] += 8
    screen.blit(background, (0, 0))
    screen.blit(alarm, site)
    screen.blit(spaceship, (0, 50))
    screen.blit(storage, (0, 150))
    screen.blit(push, (0, 400))
    pygame.display.update()
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 中文实名注册

本版积分规则

小黑屋|东台市机器人学会 ( 苏ICP备2021035350号-1;苏ICP备2021035350号-2;苏ICP备2021035350号-3 )

GMT+8, 2024-5-9 18:39 , Processed in 0.039529 second(s), 28 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表