Python Forum
first time...help - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: first time...help (/thread-9693.html)

Pages: 1 2


first time...help - JJgo - Apr-23-2018

I created my first algorithm, but I should put a loop on it ... can someone help me? ... please ..
thanks!!


RE: first time...help - micseydel - Apr-23-2018

You need to post more information. What's the algorithm? What's the code? We can't answer your question with the amount of information you're provided.


RE: first time...help - JJgo - Apr-24-2018

I created the algorithm below, but I need two loop...but I cannot understand how to do them ...
...please any advice??

#   draw three triangle of triangles
from turtle import *

# draw a triangle
for sides in range(1, 4) :
    forward(10)
    left(120)

#  move to position for second triangle
penup()
forward(5)
right(120)

pendown()
#  draw a triangle
for sides in range(1, 4) :
    forward(20)
    left(120)
#  move to position for second triangle
penup()
forward(20)
left(120)
forward(10)
right(120)
pendown()
#  draw a triangle
for sides in range(1, 4) :
    forward(30)
    left(120)



RE: first time...help - JJgo - Apr-24-2018

#   draw three triangle of triangles
from turtle import *
 
# draw a triangle
for sides in range(1, 4) :
    forward(10)
    left(120)
 
#  move to position for second triangle
penup()
forward(5)
right(120)
 
pendown()
#  draw a triangle
for sides in range(1, 4) :
    forward(20)
    left(120)
#  move to position for second triangle
penup()
forward(20)
left(120)
forward(10)
right(120)
pendown()
#  draw a triangle
for sides in range(1, 4) :
    forward(30)
    left(120)



RE: first time...help - micseydel - Apr-24-2018

JJgo:
As indicated in my first edit, you need to use code tags when you post code. This isn't optional.
You say you need to draw three triangles and you need to use two loops. I don't know what to make of this. I tried running your code but for whatever reason it doesn't do anything on the machine I'm currently on. Why do you believe you need two loops? Can you describe what your code does vs. what it needs to do? I / we can probably walk you through a solution, but you need to give more details.


RE: first time...help - JJgo - Apr-25-2018

I hope that is ok now...I created the algorithm below, but I need the loop...but I cannot understand how to do them ...

#   draw three triangle of triangles
from turtle import *
 
# draw a triangle
for sides in range(1, 4) :
    forward(10)
    left(120)
 
#  move to position for second triangle
penup()
forward(5)
right(120)
 
pendown()
#  draw a triangle
for sides in range(1, 4) :
    forward(20)
    left(120)
#  move to position for second triangle
penup()
forward(20)
left(120)
forward(10)
right(120)
pendown()
#  draw a triangle
for sides in range(1, 4) :
    forward(30)
    left(120)



RE: first time...help - JJgo - Apr-25-2018

please help...


RE: first time...help - JJgo - Apr-26-2018

Guys...any help?


RE: first time...help - micseydel - Apr-26-2018

Re-read my comments. I've requested additional information, and you've provided nothing new.


RE: first time...help - JJgo - Apr-26-2018

This is the question:
Design and implement a program to produce a simple graphical representation of a tree, as shown in Figure 1.( there are three different triangle with different size,the first at the largest base, the second in the middle, medium size and the last in the upper smallest)
Think of the output as comprising 3 levels. The lines used to make each level in the figure below are of length 10, 20 and 30 respectively. Refine your decomposition to give an algorithm, as you include extra detail make explicit use of a second loop.