Ask coding questions

← Back to all posts
please help
LoganGG

I am new to python 3 so could someone help me fix this? I have been working on python 2.7 for a year now, and i dont know what's wrong with my code. please help me!!!

Answered by Spacecraft [earned 5 cycles]
View Answer
Voters
LoganGG
Comments
hotnewtop
Spacecraft

In your function insta, you are trying to use the variable task ahead of your global definition of task. If you add one line at the beginning of the function that says global task instead of in the middle of the function, it should work.

Spacecraft

Also, you don't need to keep defining global task in the function. One time is enough.

LoganGG
LoganGG

@Spacecraft i was already doing both of those

Spacecraft

@LoganGG, ok well in the REPL that you originally shared, they were out of order. I'm not sure why you are using global at all. Nothing in your REPL currently requires you to use global for the code to work.

LoganGG

@Spacecraft like i said, i've only coded python 2.7. im new to python 3

LoganGG

@LoganGG and the error says LCOAL variable task. i need it to be GLOBAL.

LoganGG

@Spacecraft okay thanks!