Posts by IlIIIlIIlllI • 1 point
2 posts
-
-3
votes0
answers26
viewsQ: Python optimization
Is there any way to optimize the code below? I feel like I used many "Fors". texto = '' num = 10 for c in range(1, num): linha = '' for v in range(1, num - c): linha += ' ' linha += '/' for g in…
-
0
votes0
answers16
viewsQ: local error variable
g = 10 def b(): g = g + 1 b() When I do this error appears UnboundLocalError: local variable 'g' referenced before assignment I can’t put the g variable inside def b() For every time I call b() she…