Commit 762f809a by BellCodeEditor

auto save

parent 1bad0edb
Showing with 52 additions and 29 deletions
# 悟空想海龟作图画出弹簧隧道,但是出现了bug,运行不了,请你帮助他,修改bug~ b = [15,7,9,23,4,6]
import turtle
pen=turtle.Pen() def kspx(a,r,l):
screen=turtle.Screen() n = r
pen.speed() m = l
pen.hideturtle() p = a[r]
screen.bgcolor('black') while n!=m:
while p<a[m] and n<m:
m -= 1
while p>=a[n] and n<m:
n += 1
if n < m:
a[n],a[m] = a[m],a[n]
a[n],a[r] = a[r],a[n]
print(b)
return n
def px(a,u,c):
if u>=c:
return
t = kspx(a,u,c)
px(a,u,t-1)
px(a,t+1,c)
i=0 px(b,0,len(b)-1)
while i<135: print(b)
pen.pencolor('pink') \ No newline at end of file
pen.penup()
pen.goto(0,0)
pen.forward(200)
pen.pendown()
pen.circle(100)
pen.left(2)
i+=1
turtle.done()
\ No newline at end of file
# 勇于挑战的创造师,下面的代码犯了两类典型错误,请你把bug揪出来吧。 import random
area = ['盘丝洞','白骨洞','大雁塔'] a = []
monster = {'盘丝洞':'蜘蛛精','白骨洞': '白骨精','大雁塔':'花妖'} for i in range(10):
# 打印出大雁塔 a.append(random.randint(0,100))
print(area[3]) print(a)
# 向字典中添加 '地府':'僵尸'
monster.append('地府','僵尸') def kspx(l,q,z):
print(monster) p = l[q] #基准数
\ No newline at end of file n = q
m = z
while n!=m:
while n<m and p<l[m]:
m -= 1
while n<m and p>=l[n]:
n += 1
if n<m:
l[n],l[m]=l[m],l[n]
l[q],l[n] = l[n],l[q]
return n
def px(l,q,z):
if q>=z:
return
t = kspx(l,q,z)
px(l,q,t-1)
px(l,t+1,z)
px(a,0,len(a)-1)
print(a)
\ 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