Python Solutions

Python Programming Features

Python is an interpreted high-level general-purpose programming language with its notable use of significant indentation. It follows object-oriented approach.
Python 3.9.6 is the latest stable version of Python3 and Python 2 was discontinued with version 2.7.18 in 2020.
For more detailed documentation please check:
https://docs.python.org/3/

Salient Features which makes Python unique:

  1. Python uses whitespace indentation, rather than curly brackets or keywords, to delimit blocks.
  2. The assignment statement, using a single equals sign =.
  3. The if statement, which conditionally executes a block of code, along with else and elif (a contraction of else-if).
  4. The for statement, which iterates over an iterable object, capturing each element to a local variable for use by the attached block.
  5. The while statement, which executes a block of code as long as its condition is true.
  6. The try statement, which allows exceptions raised in its attached code block to be caught and handled by except clauses; it also ensures that clean-up code in a finally block will always be run regardless of how the block exits.
  7. The raise statement, used to raise a specified exception or re-raise a caught exception.
  8. The class statement, which executes a block of code and attaches its local namespace to a class, for use in object-oriented programming.
  9. The def statement, which defines a function or method.
  10. The with statement, which encloses a code block within a context manager (for example, acquiring a lock before the block of code is run and releasing the lock afterwards, or opening a file and then closing it), allowing resource-acquisition-is-initialization (RAII)-like behavior and replaces a common try/finally
  11. The break statement, exits from a loop.
  12. The continue statement, skips this iteration and continues with the next item.
  13. The del statement, removes a variable, which means the reference from the name to the value is deleted and trying to use that variable will cause an error. A deleted variable can be reassigned.
  14. The pass statement, which serves as a NOP. It is syntactically needed to create an empty code block.
  15. The assert statement, used during debugging to check for conditions that should apply.
  16. The yield statement, which returns a value from a generator function and yield is also an operator. This form is used to implement coroutines.
  17. The return statement, used to return a value from a function.
  18. The import statement, which is used to import modules whose functions or variables can be used in the current program.
  19. The assignment statement (=) operates by binding a name as a reference to a separate, dynamically-allocated object. Variables may be subsequently rebound at any time to any object.
  20. In Python, a variable name is a generic reference holder and doesn’t have a fixed data type associated with it. However at a given time, a variable will refer to some object, which will have a type. This is referred to as dynamic typing and is contrasted with statically-typed programming languages, where each variable may only contain values of a certain type.

Leave a Comment

Your email address will not be published. Required fields are marked *