Tag: python
-
python data types
Python has the following data types built-in by default, in these categories: Text Type: str Numeric Types: int, float, complex Sequence Types: list, tuple, range Mapping Type: dict Set Types: set, frozenset Boolean Type: bool Binary Types: bytes, bytearray, memoryview None Type: NoneType
-
python – unpack a collection
If you have a collection of values in a list, tuple etc. Python allows you to extract the values into variables. This is called unpacking. This is also called de-structuring in javascript. example
-
Python Variables – Assign Multiple Values
Python allows you to assign values to multiple variables in one line:
-
python type casting
though not necessary to declare the type of variable, but it can be casted to a specific type. example below
-
python comment
python comment starts with # Since Python will ignore string literals that are not assigned to a variable, you can add a multiline string (triple quotes) in your code, and place your comment inside it:
-
Python Indentation
Where in other programming languages the indentation in code is for readability only, the indentation in Python is very important. Python uses indentation to indicate a block of code. The number of spaces is up to you as a programmer, the most common use is four, but it has to be at least one. example