Python Turtle is the drawing package which comes with Python.
Task: Create a program which allows a user to input a shape, what size they wanted it to be and what colour they wanted it to be.
The program should then draw the shape for them!
You needed to solve this programming problem by yourself using the knowledge you already have in python (using turtle, defining shapes, for loops, variables) as well as figuring out how to add in an "if statement".
What is an "if statement"?
An "if statement" is where the program to checks one thing against another. For example, if the variable shape has the word "star" saved in it, the program needs to run the bit of code that draws a star.
Here is what an "if statement" looks like:
if x == 3:
print("X is equal to 3")
(The two equals signs means that Python is checking something. One equals sign means that the variable has been assigned that value.)
TASK/HINT: You need to amend your program to add in a number of "if statement" which checks what a user types in against a criteria. If the user has typed in a specific word and it meets the criteria then Python will run a bit of code.
If you go to my Google Docs the Python Turtle help sheet file is uploaded here.
If you go here you can look at Snake Wrangling for Kids (for Windows), or here for Mac. This explains about "if statements".
No comments:
Post a Comment