Error in python indentation

Asked

Viewed 165 times

0

I already program in c, I’m mdc in Python but I’m struggling with indentation, because in c we don’t care about it, someone could help me, my code below

numero = int(input())
for i in range():
  x = int(input())
  n = int(input())
    int resto = x % n
    while(resto!=0)
        x = n
        n = resto
        resto = x % n
print(n2)
  • Friend has several things wrong with your code before identation, do not need to declare the type of variable int on the fifth line, there is no : no while while(condicao): and there is also no variable n2. At first glance, it seems to be the errors you have. Identation advise to use tab.

1 answer

1

Hello,

Basically about the indentation in python, it is it that defines the block of instructions to be executed by certain control instruction (loop, conditions, etc). It resembles the keys used in C, javascript, PHP.

On your example specifically, it does have some problems with syntax and indentation. I suggest checking in https://www.python.org/doc/ to give a footprint in the basics.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.