0

How to do indent in python ??with rules and example...

2nd Aug 2019, 3:36 PM
Kyle
Kyle - avatar
2 odpowiedzi
+ 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...)
2nd Aug 2019, 3:44 PM
Gwlanbzh
Gwlanbzh - avatar
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")
2nd Aug 2019, 5:50 PM
Trigger
Trigger - avatar