Commit e6d3ead6 by BellCodeEditor

auto save

parent 47f05618
Showing with 43 additions and 17 deletions
a={}
a[1]='abc'
a[True]=234
a[False]=123
a[0]=567
a[3.14]=88
a["ab"]=100
a[(4,5)]=1000
for x in a.keys():
print(x)
for x in a.values():
print(x)
for x,y in a.items():
print(x,y)
\ No newline at end of file
import random
i=0
while True:
a=input("玩家:")
print("玩家出拳:",a)
cq=["石头","剪刀","布"]
b=random.choice(cq)
print("电脑出拳:",b)
if a in cq:
if a==b:
print("平局")
elif a=="石头" and b=="剪刀" or a=="剪刀" and b=="布" or a=="布" and b=="石头":
print("You Win")
else:
print("You Lose")
else:
print("输入错误!")
\ No newline at end of file
import turtle
turtle.speed(0)
for i in range(5):
turtle.seth(-15)
turtle.left(30*i)
turtle.circle(70, 90)
turtle.left(90)
turtle.circle(70, 90)
turtle.hideturtle()
turtle.done()
\ No newline at end of file
a=[1,2,3]
print(id(a))
a.append(100)
print(id(a))
\ No newline at end of file
......@@ -46,16 +46,23 @@ cube_colors = [
(153, 0, 51), (204, 255, 102), (255, 153, 0)]
center = [2, 8] # 第2行第8列
current_shape = t[0]
index=random.randint(0,len(t)-1)
current_shape = t[index]
color=random.choice(cube_colors)
def check(center):
for cube in current_shape:
pos = (cube[0] + center[0], cube[1] + center[1])
if cube[0]<1 or cube[1]<1 or cube[0]>grid_num_width or cube[1]>grid_num_height:
return False
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
exit()
if event.type == locals.KEYDOWN:
if event.key == locals.K_RIGHT: # 向右
if center[1] < 15:
center[1] += 1
if check(center)==False:
center[1] -= 1
elif event.key == locals.K_LEFT: # 向左
if center[1] > 1:
center[1] -= 1
......
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