Untitled
unknown
plain_text
a year ago
1.1 kB
21
Indexable
from turtle import Turtle
# iniciar uma turtle
t = Turtle()
t.speed(1)
while True:
direcao = input("Para qual direção devemos ir? f: frente ou t: trás: ")
if direcao == "f":
pixels = int(input("Quantos Pixels devemos movimentar para frente?: "))
elif direcao == "t":
pixels = int(input("Quantos Pixels devemos movimentar para trás?: "))
rotacionar = input("Rotacionar d: direita, e: esquerda, n: não rotacionar: ")
if rotacionar == "d":
graus = int(input("Quantos graus rotacionar para a direita? "))
t.right(graus)
t.forward(pixels)
elif rotacionar == "e":
graus = int(input("Quantos graus rotacionar para a esquerda? "))
t.left(graus)
t.forward(pixels)
elif rotacionar == "n":
if direcao == "f":
t.forward(pixels)
if direcao == "t":
t.backward(pixels)
continuar = input( "Continuar andando? s: sim, n: não: ")
if continuar == "s":
continue
elif continuar == "n":
break
input()Editor is loading...
Leave a Comment