Python Forum
Question about moving a turtle
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question about moving a turtle
#1
Question about moving a turtle - multiplying index by 10 on line 15 moves the next line over 10 pixels on the x-axis, but if the first value of index in range(5) is zero, then how does 10 * 0 (which just equals zero) actually change the next line's x position? I sure I am just not understanding something. Thanks.

from turtle import * space = Screen() height = space.window_height() maxY = height / 2 sue = Turtle() sue.pensize(10) sue.left(90) for index in range(5): sue.penup() if index % 2 == 0: sue.color('red') else: sue.color('black') sue.goto(index * 10, -1 * maxY) sue.pendown() sue.forward(height)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Noob question: why is shapesize() not working for my turtle adifrank 8 11,294 Sep-09-2020, 11:13 PM
Last Post: adifrank
  wn = turtle.screen() AttributeError: module 'turtle' has no attribute 'screen' Shadower 1 8,128 Feb-06-2019, 01:25 AM
Last Post: woooee
  Help! Turtle not working, even when we click the turtle demo in IDLE nothing happens. BertyBee 3 8,685 Jan-04-2019, 02:44 AM
Last Post: SheeppOSU
  turtle moving platform chappie 1 4,268 Dec-06-2017, 10:52 PM
Last Post: chappie
  Turtle Bar Chart Colour fill question JRod 3 8,258 Feb-09-2017, 11:06 PM
Last Post: ichabod801

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020
This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.