from turtle import *
t=Turtle()
import math
def square():
t.forward(25)
t.left(90)
t.forward(25)
t.left(90)
t.forward(25)
t.left(90)
t.forward(25)
t.right(180)
t.forward(25)
t.right(90)
square()
t.left(180)
t.forward(25)
t.right(90)
t.forward(25)
t.right(90)
t.forward(25)
t.right(90)
t.forward(25)
t.left(90)
square()
t.forward(25)
t.right(90)
t.forward(25)
t.left(90)
square()
t.left(180)
t.forward(25)
t.right(90)
t.forward(25)
t.right(90)
t.forward(25)
t.right(90)
t.forward(25)
t.left(90)
square()
t.forward(25)
t.right(90)
t.forward(25)
t.left(90)
square()
t.left(180)
t.forward(25)
t.right(90)
t.forward(25)
t.right(90)
t.forward(25)
t.right(90)
t.forward(25)
t.left(90)
square()
t.forward(25)
t.right(90)
t.forward(25)
t.left(90)
square()
t.left(180)
t.forward(25)
t.right(90)
t.forward(25)
t.right(90)
t.forward(25)
t.right(90)
t.forward(25)
t.left(90)
t.forward(25)
t.left(90+45)
t.forward(math.sqrt((25**2)+(25**2)))
t.left(45)
t.forward(25)
t.left(45)
t.forward(math.sqrt((25**2)+(25**2)))
t.forward(math.sqrt((25**2)+(25**2)))
t.forward(math.sqrt((25**2)+(25**2)))
t.left(45)
t.forward(25)
t.left(45)
t.forward(math.sqrt((25**2)+(25**2)))
t.left(45)
t.forward(25)
t.left(45)
t.forward(math.sqrt((25**2)+(25**2)))
t.forward(math.sqrt((25**2)+(25**2)))
t.forward(math.sqrt((25**2)+(25**2)))
ค้นหาบล็อกนี้
วันเสาร์ที่ 13 พฤศจิกายน พ.ศ. 2553
ข้อ 3
from turtle import *
t=Turtle()
def square():
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
t=Turtle()
def square():
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
ข้อที่ 3
from turtle import *
t=Turtle()
def square():
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
t=Turtle()
def square():
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
t.forward(20)
t.right(90)
t.forward(20)
t.right(90)
t.forward(20)
t.left(90)
t.forward(20)
t.left(90)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
square()
t.forward(20)
คำตอบข้อแรก
credit = int(input("Input credit: "))
LOWEST = 1
HIGHEST = 100
B = credit
A = count
while A < B:
count = count + 1
if count > credit:
print("Game over! The solution is %s!" % (answer))
break
guess = int(input('[%d/%d] Guess the number between %d-%d: ' % (count, B, LOWEST, HIGHEST)))
if guess > answer:
print("Too high")
HIGHEST = guess - 1
if guess < answer:
print("Too low")
LOWEST = guess + 1
if guess == answer:
print("Correct answer!")
print("You guessed",count,"times.")
break
LOWEST = 1
HIGHEST = 100
B = credit
A = count
while A < B:
count = count + 1
if count > credit:
print("Game over! The solution is %s!" % (answer))
break
guess = int(input('[%d/%d] Guess the number between %d-%d: ' % (count, B, LOWEST, HIGHEST)))
if guess > answer:
print("Too high")
HIGHEST = guess - 1
if guess < answer:
print("Too low")
LOWEST = guess + 1
if guess == answer:
print("Correct answer!")
print("You guessed",count,"times.")
break
สมัครสมาชิก:
บทความ (Atom)