Commit 1b07da2e by BellCodeEditor

auto save

parent c66a449e
Showing with 35 additions and 22 deletions
# 利用write()帮助悟空给诺依回信吧~
import turtle
screen=turtle.Screen()
screen.bgcolor("light blue")
len=screen.textinput("100","100")
len=int(len)
pen=turtle.Pen()
pen.write("你好\nSB.",font=("Times",30,"normal"))
pen.hideturtle()
len=60
pen.penup()
pen.goto(100,100)
pen.pendown()
pen.pensize(5)
pen.pencolor("red")
pen.left(45)
pen.forward(2*len)
pen.circle(len,180)
pen.right(90)
pen.circle(len,180)
pen.forward(2*len)
turtle.done()
'''
n=int(input()) # 假设n=5
ren=list(range(1,n+1)) # 将所有的人都放入一个列表中
count=0 # 用来计算报数
while len(ren)>1: #当列表中至少有2人的时候进行循环
new_ren=ren[:] #把原来的列表复制到新列表中,用来限制for循环的次数
for i in range(0,len(new_ren)): # 从第一个人开始报数
count=count+1 # 每报一次,count加1
if count%3==0: # 如果报到3
ren.remove(new_ren[i]) #把报到3的人从原列表中删除,进行下一轮循环
print(new_ren[1])
format格式化字符串:
此方法是使用一个字符串作为模板,使用{}作为占位符,
通过传入的参数替换占位符,就得到格式化后的字符串。
'''
#print('我叫{},今年{}岁'.format('王鼎文',11))
# split()
# sort()
# join()
n=input()
list=n.split(',')
new_list=[] # 用来保存转换为整型的数字
for i in list:
new_list.append(int(i))
new_list.sort(reverse=True)
a=[str(i) for i in new_list]
print(','.join(a))
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