Proper indentation in python | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 2

Proper indentation in python

What’s the proper way to make an indentation in python kicking tab or doing a space 3 times when I mix tabs and spaces it gives me a error so what’s the proper way spaces or tab ?

7th Oct 2022, 4:11 AM
Lz1234
4 ответов
+ 7
Lz1234 , the python style guide (pep 8) mentiones to use 4 spaces per indentstion level. the tab key can also be used if the editor can convert tab to spaces. playground on android devices support this. mixing (real) tabs and spaces is not allowed. for more information read: https://peps.python.org/pep-0008/#indentation
7th Oct 2022, 8:20 PM
Lothar
Lothar - avatar
+ 5
Lz1234 , please use the link that is provided in my post. scroll down a bit and you will find the information. ... Code Lay-out Indentation Use 4 spaces per indentation level. ...
9th Oct 2022, 4:54 PM
Lothar
Lothar - avatar
+ 1
Lothar So im understanding that spaces are the pefered way I thought is was 3 spaces are you sure about the 4
9th Oct 2022, 12:59 AM
Lz1234
+ 1
Lz1234 What did you see in the guide Lothar posted?
9th Oct 2022, 6:29 AM
Emerson Prado
Emerson Prado - avatar