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
Thanks
python indentation confusion
|
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
I suggest reading python 101: https://www.blog.pythonlibrary.org/2017/...rmanently/
It's free, and it's good! You will have fun reading and trying the code.
Sep-01-2017, 07:51 PM
Thanks, I will definitely check it out!!
Sep-01-2017, 09:00 PM
this might help
https://python-forum.io/Thread-Basic-Indentation
Recommended Tutorials:
Sep-02-2017, 05:59 AM
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
Sep-02-2017, 12:04 PM
Thanks everyone it really helped me a lot
|
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
![]() |
Python Shell 3.9.0 - Issue with indentation | Earis | 17 | 10,799 |
Oct-31-2020, 07:00 AM Last Post: Earis |
python ast if-elif confusion | holyghost | 3 | 4,547 |
Apr-19-2020, 12:36 PM Last Post: pyzyx3qwerty |
|
Indentation error in Python code | ErnestTBass | 5 | 4,847 |
Feb-28-2019, 04:26 PM Last Post: samsonite |
|
Python and bash command confusion | MuntyScruntfundle | 0 | 2,452 |
Oct-11-2018, 04:52 PM Last Post: MuntyScruntfundle |
|
python wont recognize indentation | JWhykes | 6 | 5,417 |
Jul-06-2018, 10:55 AM Last Post: JWhykes |
|
File access confusion python windows | PickyBiker | 0 | 3,888 |
May-08-2017, 05:36 PM Last Post: PickyBiker |