VisuAlg Web

Encontrando Erros (Debug)

No Python, o ponto de depuração padrão é breakpoint() , útil para pausar execução e inspecionar estado.

No Python, o ponto de depuração padrão é breakpoint(), útil para pausar execução e inspecionar estado.

Exemplo de códigoPython


breakpoint()

x = 10
y = 5
# In the output console, step line by line and inspect x and y
x = x + y
y = x - y
x = x - y
# This classic logic swaps variables without using a temporary variable!
print("Now x is ", x, " and y is ", y)
Exemplo de códigoPython


breakpoint()

print("Use p/next to step and i to inspect.")
for i in range(1, 3 + 1):
# At each step, inspect i in the console to see the increment happening
print(i)
print("To exit step-by-step mode, type c and press Enter.")