QR Code // SOLVED | Sololearn: Learn to code for FREE!

+3

QR Code // SOLVED

Hey guys, what do you think about this code?. https://code.sololearn.com/cHpCMqh3PzE9/?ref=app

1/10/2020 5:06:59 AM

el3be

8 Answers

New Answer

+1

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!

+1

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?

+1

Thank you friend!!

0

To define the variable código with str input, redirects me to the exception ( line 36 )

0

These are the changes I propose, the rest looks ok def crearQR(codigo): qrcode.make(codigo) ... def definicion(): ... crearQR(codigo)

0

Tibor Santa can you solve my code?

0

Solve? What do you mean? I gave you the fix didn't I?

0

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.