0
How to do indent in python ??with rules and example...
2 Antworten
+ 1
Uh... Just indent? Instead of the opening curly bracket in other languages, just type a colon. Then, on the indented lines, add a tab at the beginning of the line. For end indenting, just stop adding tabs. But you could learn that in the Python course...
For example:
list=['a','b','c']
for i in list:
print(i)
Yes, here I typed 4 spaces, but it also works(for that, I don't know any rule... stay using tabs, and maybe it will be converted to spaces...)
0
Rule of thumb, press tab after every colon (":")
name = "Thomas"
while True:
# another indent
if name == "Thomas":
print("Your name")
else:
print("Not your name")