python indentation confusion - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: python indentation confusion (/thread-4665.html) |
python indentation confusion - hello_its_me - Sep-01-2017 Hi, I just started with python and I was coding in C# before and there is my biggest problem.... I am used to the {} and can't figure out how to structure if, while.... can somebody please help me? Thanks RE: I need some help (I am new to python) - Larz60+ - Sep-01-2017 I suggest reading python 101: https://www.blog.pythonlibrary.org/2017/01/23/python-101-now-free-on-leanpub-permanently/ It's free, and it's good! You will have fun reading and trying the code. RE: I need some help (I am new to python) - hello_its_me - Sep-01-2017 Thanks, I will definitely check it out!! RE: I need some help (I am new to python) - metulburr - Sep-01-2017 this might help https://python-forum.io/Thread-Basic-Indentation RE: python indentation confusion - wavic - Sep-02-2017 Basicaly, the indentation in Python forms a code block just like {} in the other languages. So if some code after if statement has to be executed you indent it just after the 'if': if 5 in range(1,14): print('True') # 'if' statement code block result = 5**5 # 'if' statement code block print(result) # 'if' statement code block print('Done!') # out of the 'if' statement RE: python indentation confusion - hello_its_me - Sep-02-2017 Thanks everyone it really helped me a lot |