找回密码
 中文实名注册
查看: 186|回复: 3

【python作业】高刘熙

[复制链接]

3

主题

18

帖子

1484

积分

金牌会员

Rank: 6Rank: 6

积分
1484
发表于 2022-8-19 18:52:28 | 显示全部楼层 |阅读模式
def count(price_list):
    total = sum(price_list)
    if total >=200:
        result = total * 0.6
    elif total >= 100:
        result = total * 0.7
    else total <= 100:
        result = total * 0.8
    print(result)
    count([54,76,23,90,67,84])
回复

使用道具 举报

3

主题

18

帖子

1484

积分

金牌会员

Rank: 6Rank: 6

积分
1484
 楼主| 发表于 2022-9-4 15:38:22 | 显示全部楼层
class Car():
    def __init__(self,color,people):
        self.color = color
        self.people = people
        self.positon = [400,300]
        self.change_direction = 'right'

    def foreward(self):
        self.change_direction = 'up'
        self.positon[0] += 5
回复

使用道具 举报

3

主题

18

帖子

1484

积分

金牌会员

Rank: 6Rank: 6

积分
1484
 楼主| 发表于 2022-9-4 15:38:55 | 显示全部楼层
class Car():
    def __init__(self,color,people):
        self.color = color
        self.people = people
        self.positon = [400,300]
        self.change_direction = 'right'

    def foreward(self):
        self.change_direction = 'up'
        self.positon[0] += 5
回复

使用道具 举报

3

主题

18

帖子

1484

积分

金牌会员

Rank: 6Rank: 6

积分
1484
 楼主| 发表于 2022-9-11 15:40:43 | 显示全部楼层
import pygame
import sys
pygame.init()
screen = pygame.display.set_mode((800,600))
bg=pygame.image.load('image\星海背景.png')
bg=pygame.image.load('image\炮台_红色珠子.png')

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.type == pygame.KEYDOWN:
            if event.key == pygame.K_DOWN:
                site[1] +=8
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_LEL:
                site[0] -=8
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_RIGHT:
                site[0] +=8
        print(site)
    if event.type == pygame.MOUSEBUTTONDOWN:
        print(event.pos)
        site2=list(event.pos)
        print(site2)
        
    screen.blit(bg,(0,0))
    screen.blit(ball,site)
    screen.blit(ball,(site2[0]-29,site2[1]-29))
    pygame.display.update()
            




























































回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-8 18:06 , Processed in 0.042777 second(s), 28 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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