Hi, I'm totally a nob to programming and just started with Python, so please forgive me if I'm not yet too familiar with the terms.
I'm trying to define a way which a code can be reuse to allow user to change the color of the turtle object. However, I keep getting error when I run it in the shell.
The error that I get in shell is saying error in line "else pc == "red": saying it is invalid syntax, the line that I ran is square("red").
I appreciate any help anyone can point out.
I'm trying to define a way which a code can be reuse to allow user to change the color of the turtle object. However, I keep getting error when I run it in the shell.
The error that I get in shell is saying error in line "else pc == "red": saying it is invalid syntax, the line that I ran is square("red").
I appreciate any help anyone can point out.
import turtle pointer = turtle.Turtle() increase = input("Enter amount to expand image.") increase = int(increase) side = input("How many pixels for each side?") side = int(side) def square(pc): if pc == "white": pointer.color("white") elif pc == "black": pointer.color("black") else pc == "red": pointer.color("red") for box in range(4): pointer.forward(increase*side) pointer.right(90)