Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4
Those languages that depend on indentation are disaster! That is, some barely countable spaces change the whole role of a line of code or a segment, leading to weird bugs and errors. [my personal opinion]
26th Nov 2022, 1:11 PM
Tina
Tina - avatar
26th Nov 2022, 1:33 PM
Jayakrishna 🇮🇳
+ 3
<DD> I remember Fortran was also space dependant. there might be more.
26th Nov 2022, 1:54 PM
Tina
Tina - avatar
+ 3
<DD> Yes, as I mentioned earlier it's a disaster. I don't know what's wrong with a ";" to mark end of statement, and with "{}" code is more clear, precise and most code editors today even highlight the matching pairs. Perhaps those stupid indentations makes the interpreter's job easier.
26th Nov 2022, 2:47 PM
Tina
Tina - avatar
+ 3
In my opinion python suits programmers who right neat, tidy code (i.e., those who right code that is easy to see the block levels). For those programmers python's indentation requirements are fairly natural, and it saves them from things like having to type ; everywhere and enclose blocks in {}. But with today's IDEs, the syntax is often filled in for you (i.e., you don't need to type those pesky semicolons or braces), and this let's you be as messy as you want to be with how you lay out your code. For which the next person who has to read it, or modify or maintain it, will probably curse you. 😅 So looking at things this way, python makes you write code that will be easier for someone else to understand - and hopefully easier to modify or maintain. All my opinion.
26th Nov 2022, 3:44 PM
Steve
Steve - avatar
+ 3
Steve , you did bring out very good points and I'm agree with you (about some people writing messy code) but let's be fair, I mean, from the link: indentation in Python improves readability! 😁 Python is more like pseudo code in English, different font size/styles could help more 😅😉
26th Nov 2022, 6:11 PM
Tina
Tina - avatar
+ 3
Here's some Indentations rules you may not know in Python : 1- In Python, indentation is for logical lines, so the first thing to do is to distinguish between physical and logical lines in your code. Logical line: The Python interpreter interprets the code, and a statement is a logical line. Physical Line: The code displayed in the code editor, each line is a physical line. 2- “;” connector In python code, you can use ";" to combine multiple logical rows into one physical row 3- “\” connector You can use "\"to wrap a logical line and write it as multiple physical lines. 4- “=” operator Variable assignment statements such as dictionaries and lists can be directly wrapped and written as multiple physical lines. 5- “:” Mark a new logical layer : operator will mark a new logical layer, we often see this in while loop, if branch, function declaration, class definition, etc. https://medium.com/geekculture/python-tips-how-indentation-works-8c3953b98c1a
27th Nov 2022, 4:37 PM
Arshia Pazoki
Arshia Pazoki - avatar
+ 3
Arshia Pazoki For your 4th rule, it's not the assignment, "=", operator that allows wrapping. It's the open "[", "(", "{", or quote that allows a statement to span lines (though in the case of quotes - ''' or """ the newline character will be part of the string).
27th Nov 2022, 7:08 PM
Steve
Steve - avatar
28th Nov 2022, 1:44 PM
Tina
Tina - avatar
+ 3
<DD> That's cool! is there something like IOCCC for python? 😅 like IOPCC? plus the code I wrote logically is an endless loop, but due to my lack of knowledge, python does miracles!
28th Nov 2022, 2:53 PM
Tina
Tina - avatar
+ 3
28th Nov 2022, 3:15 PM
Steve
Steve - avatar
+ 2
Also, for the record, I haven't come across a language yet that I don't like. Each is unique and has strong points and weak points. And I'm a big believer in using the right tool for the problem.
26th Nov 2022, 3:48 PM
Steve
Steve - avatar
+ 2
Indentation refers to the spaces at a beginning of a code line. Python uses indentation to indicate a block of code. Indentation in python is very important, but in other programming languages indentation is only for readability. Indentation in python example:- If 10>5: print("Ten is greater than five.")
27th Nov 2022, 8:40 AM
Anonymous
Anonymous - avatar
+ 2
Indentation refers to the spaces at a beginning of a code line.. In other programming languages, indentation in a code line is only for readability, but indentation in python is very important.
28th Nov 2022, 6:53 AM
Anonymous
Anonymous - avatar
28th Nov 2022, 3:23 PM
Steve
Steve - avatar
+ 1
Tina 🕊🇺🇦🇮🇷 you hit it right on the head, writing Python is like writing pseudo-code. Except it actually works! 😁
26th Nov 2022, 6:44 PM
Steve
Steve - avatar
0
I have a question I Write this print("WeLcome to Berbera")
28th Nov 2022, 7:35 AM
Jim'ale Nour
Jim'ale Nour - avatar