Uploaded by Peach

python programming 4

advertisement
Strings
NO NEED TO RETYPE PROGRAMS.
Example 1
Example 2
Example 3
Example 4
1. the square brackets around the colors and in the for loop. Lists require square brackets.
2. In line 2, we can use shapes are our drawing tool e.g. turtle, triangle, square etc
3. t.stamp just stamps the drawing tool on the canvas.
Example 5
Question 1 [user adding items to a list] Solution given.
Create a program which askes users for a maximum of six items on their shopping list and will out
put their list after each addition. This exercise uses strings.
Question 2
Look at the program in example 4.
Can you modify the program to ask the user to select the six colors.
Question 3
Can you modify question 2 to also ask the user not only for colours but to ask them how many
turtles they want to output?
Question 4:
Ask a user how many sides they would like on their shape.
Ask the user how many shapes they would like.
Ask them what colors they would like for each shape. This should be added to a list. If they selected
4 shapes, they should be asked to select 4 colors.
Output the shapes in a circular way like in example 4 with the turtles.
SOLUTIONS TO FOLLOW…..
Download