I am learing Python and tried to input variables but they did not give the expected outcome. I was hoping for it to change "boy_name" into "bobby", but it did not.
Here is the code
print("there was a boy named " boy_name " ")
print("there is a boy named timmy")
boy_name = "Bobby"
CodePudding user response:
You are using the variable before it declaration.
Carry your variable declaration at the top of the first print function
For Example
boy_name = "Bobby"
print("there was a boy named " boy_name " ")
print("there is a boy named timmy")