1.使用turtle换一个五环
import turtle
turtle.pensize(15)
turtle.penup()
turtle.color('blue')
turtle.goto(-150,-35)
turtle.pendown()
turtle.circle(60)
turtle.penup()
turtle.color('black')
turtle.goto(0,-35)
turtle.pendown()
turtle.circle(60)
turtle.penup()
turtle.color('red')
turtle.goto(150,-35)
turtle.pendown()
turtle.circle(60)
turtle.penup()
turtle.color('yellow')
turtle.goto(-70,-105)
turtle.pendown()
turtle.circle(60)
turtle.penup()
turtle.color('green')
turtle.goto(70,-105)
turtle.pendown()
turtle.circle(60)
2.设计这样一个程序:输入一个数字 判断它是不是一个质数
a = int(input("请输入一个数字:"))
b = 2
while b < a :
if a % b == 0 :
print ("该数字不是质数")
break
b += 1
else:
print("该数字是质数")
break