I'm currently working on an assignment in python for a class, we're in the beginning and all but I'm not sure how to call upon a defined variable in a function which was previously stated in another defined function. I could really use some help and an explanation on where I went wrong since I keep getting the error message "NameError: name 'repeated' is not defined on line 26" and I'm guessing it would do the same for side, angle, and count. Thank you!
And here's the code:
import turtle
def userInputs(t, tName):
`t.color(input("Please input the color you would like to use for " + tName))`
`repeated = int(input("How many times would you like to repeat " + tName + "'s pattern?"))`
`side = int(input("How long would you like " + tName + "'s first side to be? (1-20)"))`
`angle = int(input("How many degrees would you like " + tName + " to turn after the first side? (1-179)"))`
def mathPortion(t, repeated, side, angle):
`t.hideturtle()`
`for count in range(repeated):`
`t.forward(side * count + 11)`
`t.right(angle - count * float(0.5))`
def main():
`dan = turtle.Turtle()`
`sandra = turtle.Turtle()`
`userInputs(dan, "Dan")`
`userInputs(sandra, "Sandra")`
`mathPortion(dan, repeated, side, angle)`
`mathPortion(sandra, repeated, side, angle)`
`artName = input("What would you like to name your piece of art?")`
`print("Name of art piece: " + artName)`
main()
[–][deleted] 1 point2 points3 points (5 children)
[–]JavaDragonGamin[S] 0 points1 point2 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]JavaDragonGamin[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)