Python is a case sensitive programming language.
Python vs Java
- Python is Dynamically Typed. No need to declare anything. An assignment statement binds a name to an object, and the object can be of any type.No type casting required when using container objects where as Java is Statically Typed. All variable names (along with their types) must be explicitly declared. Attempting to assign an object of the wrong type to a variable name triggers a type exception.Type casting is required when using container objects.
- Python uses indentation for structuring code where as Java uses braces for structuring code.
- Python is more compactable when compared to Java.
To print Hello ,World! in java,
but in Python,
Python uses indentation to represent block of code.The number of spaces in the indentation is variable, but all statements within the block must be indented the same amount.
Indentation can be done by using space-bar or tab. 1 tab = 4 spaces.
- Class names start with an uppercase letter.
- All other identifiers start with a lowercase letter.
- An identifier starting with a single leading underscore indicates that the identifier is private. Similarly an identifier starting with double leading underscores indicates a strong private identifier.
- If the identifier also ends with two trailing underscores, the identifier is a language-defined special name.
A hash sign (#) that is not inside a string literal is the beginning of a comment.
Quotations in python
Python accepts single (‘), double (“) and triple (”’ or “””) quotes to denote string literals.The triple quotes are used to span the string across multiple lines.