+ 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]
+ 3
I hope this helps clearly..
https://code.sololearn.com/cT5BRIbkia21/?ref=app
https://www.sololearn.com/discuss/2983351/?ref=app
+ 3
<DD> I remember Fortran was also space dependant. there might be more.
+ 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.
+ 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.
+ 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
+ 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).
+ 3
โHRITIK GAUTAMโ , <DD>
a newbie coding in Python ๐
https://code.sololearn.com/c4Tmr9m2GJfB/?ref=app
+ 3
Tina ๐๐บ๐ฆ๐ฎ๐ท Here is such a competition within Sololearn:
https://www.sololearn.com/post/1345238/?ref=app
+ 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.
+ 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.")
+ 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.
+ 2
โHRITIK GAUTAMโ Take a look at @AJ's answer here:
https://www.sololearn.com/Discuss/3107593/?ref=app
+ 1
Tina ๐๐บ๐ฆ๐ฎ๐ท you hit it right on the head, writing Python is like writing pseudo-code. Except it actually works! ๐
0
I have a question I Write this print("WeLcome to Berbera")