Commit b99f860d by BellCodeEditor

save project

parent 05e7d622
Showing with 74 additions and 0 deletions
def new_input():
total = 0
while True:
unit=input("请输入数字")
if unit=="q":
break
else:
try:
unit=int(unit)
except:
print("格式错误,输入整数!")
else:
total=total+unit
print(total)
return total
c=new_input()
print(c)
\ No newline at end of file
import z
h=z.new_input()
g=z.count(ch)
print("成绩是"+str(g))
\ No newline at end of file
import pygame
from pygame import locals
pygame.init()
breakground = pygame.import.load("bg.png")
right = pygame.impor.load('right.png')
food = pygame.impor.load('apple.png')
screen=pygame.display.set_mode((660,480))
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
exit()
screen.blit(background,(0,0))
screen.blit(apple,(290,120))
screen.blit(food,(360,300))
screen.blit(boby,(210,120))
screen.blit(boby,(180,120))
screen.blit(boby,(180,90))
screen.blit(boby,(180,60))
pygame.display.update()
\ No newline at end of file
def new_input():
total=[]
while True:
data=input("请输入价格")
if data=="q":
break
else:
try:
data1=int(data)
except:
print("请输入数字")
else:
total.append(data1)
return total
result1=new_input()
#print(result1)
def count(list):
a=0
for i in list:
a=a+i
#print("价格总和是"+str(a))
return a
result2=count(result1)
print(result2)
\ 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