How would I tell my arrow to move forward 100 pixels?
forward(100)
How would I ask for a word from the user?
word = input("Enter a word: ")
Can your computer count to a million using a for loop?
Yes
What is one purpose of a function?
To make code readable
To reuse code
To organize code
IDLE
If I want to make one full rotation to the left or right, how many degrees should I turn?
360
How may I ask the user for a number?
number = int(input("Enter a number: "))
Write me a for loop that moves forward 50 10 times...
forward(50)
Write the first line that you need to write to define a function. Use the name draw()
What are the four words that we need at the top of our program?
from turtle import *
What two commands do we need to draw a square?
forward
left/right
for _ in range(8):
col = input("Color: ")
How many colors does this ask for?
8
Draw me a triangle using a for loop...
for _ in range(3):
forward(100)
left(120)
Why do we need to indent inside functions?
So the computer knows what lines are inside and outside of our function.
Python is a programming language. Name another programming language.
HTML/Swift/CSS/Java/C+/C#
Explain the process for centering our drawing...
- Find height and width
- Divide both by 2
- Check if negative/positive based on where you would like to start
number = int(input("Enter a length: "))
for _ in range(10):
forward(number)
How many pixels does this program move forward when number is 67?
670
How many for-loops can I put inside a for-loop?
Unlimited.
Write me a function that takes a user color and changes the color to that user color. Call the function choose_and_change_color()
c = input("Which color: ")
color(c)
Name one invention that you use that was coded using Python
Youtube
Wrap the statement in penup() and pendown() commands.
Write me code that draws a user-inputed number-sided polygon...
x = int(input("Enter a number: "))
for _ in range(x):
forward(67)
left(360/x)
How would I write a double for loop so I can draw 5 squares in a line?
for _ in range(5):
for _ in range(4):
forward(100)
left(90)
forward(100)
Write me a function that draws the Italian flag.
draw it using IDLE and show it to me
Write me a program that draws me a chessboard with alternating colors...
show me