Tracy will draw a slinky with 5 loops. <hr> As you explore this example, test out the following: * Look at each command. What do you notice about the syntax, or the way each command is written? * Change the order of the commands. How does the functionality of the program change? * Make the following changes and note their effect including any error messages produced: * Capitalize the first letter in one of the `circle` commands * Remove the parentheses in the first command * Remove the closing parenthesis in the first command * Add a blank line between the commands on the 2nd and 3rd lines * Indent only the first command * Indent only the second command * What happens if every numerical value in the program (inside all `circle` and `forward` commands) is the same number? What do you notice about the spacing between circles? * How must the numbers in the `circle` and `forward` commands be altered to have the circles line up next to one another instead of overlapping?
This code will draw a red circle, blue square, and yellow triangle all using the `circle()` command. <hr> As you explore this example, test out the following: * What happens if you draw the yellow triangle first and the red circle last? * What happens if you use the advanced circle command with 10 steps to draw the red circle (`circle(75, 360, 10)`)? * Do some testing. How many steps do you feel are required for a shape to look like a circle? * Change the radius of the circle to 150. (*Note: The shape will extend off of the canvas.*) Does this same number of steps still result in a shape that looks like a circle?
This program will draw a horizontal line with hash marks at 25, 50, 100, and 200 pixels which have a thickness given by the user. Before drawing each mark, the user will be asked for a color and the mark will be drawn in that color. <hr> As you explore this example, test out the following: * Alter the command on line 35 to read: `length *= 2`. * Run the program. What happens? * Read through [this article](https://careerkarma.com/blog/python-operator/). What are these types of operators (`+=`, `-=`, `*=`, `/=`) referred to as? * Why are these operators useful? * What happens if `int` is added to the input command on line 33? * ex: `color_choice = int(input("What color should this mark be?: "))` **[Optional] Higher level concepts:** * What happens if the `int` is removed from the input command on line 27? * ex: `mark_thickness=input("What is the thickness of the marks? (1-20): ")` * *Note:* To understand why this is, try replacing the command on line 14 with `pensize("10")`. Does this program still work? How does this relate to removing the `int` on line 27? * Read through [this article](https://www.programiz.com/python-programming/type-conversion-and-casting). What is it called when Python automatically converts one data type to another? * With the `int` removed on line 27, what happens when you add the following lines to the end of the for loop? * `mark_thickness = mark_thickness + 2` * `mark_thickness = mark_thickness - 2` * `mark_thickness = mark_thickness * 2` * Add this line before to see what is happening to the `mark_thickness` value: `print(mark_thickness)`. Are the values being altered as you would expect? * `mark_thickness = mark_thickness / 2` * Read through [this article](https://careerkarma.com/blog/python-unsupported-operand-types-for-str-and-int/) to understand what is happening in these situations.
Sign up for a free teacher account to get access to curriculum, teacher tools and teacher resources.
Teacher SignupSign up as a student if you are in a school and have a class code given to you by your teacher.
Student Signup