QR Code // SOLVED
Hey guys, what do you think about this code?. https://code.sololearn.com/cHpCMqh3PzE9/?ref=app
In your original code you get NameError because crearQR does not have access to the local variable you define in the other function. Therefore the best way is to pass it as parameter!
Looks like a nice little console application, you have functions with clear purpose, you have error handling.. I would probably pass the url (codigo variable) as parameter to the crearQR function, because it is in the local scope of the other function. Do you have any specific questions?
Thank you friend!!
To define the variable código with str input, redirects me to the exception ( line 36 )
These are the changes I propose, the rest looks ok def crearQR(codigo): qrcode.make(codigo) ... def definicion(): ... crearQR(codigo)
Tibor Santa can you solve my code?
Solve? What do you mean? I gave you the fix didn't I?
Tibor Santa no, I mean that if You can solve the error that you say, because I pass the variable as parameter but another error appears.