Python is a general purpose, interpreted, object-oriented language that was initially developed by Guido van Rossum in 1991. It was designed to combine dynamic features (i.e., dynamic typing, exceptions) with strong static features (i.e. type checking, code documentation). As a result, programmers do not need to spend time fixing errors at runtime. Python's syntax resembles C-like languages with additional syntactic sugar and operator overloading.
Characteristics of Python Programming
A function is a self contained block of instructions that perform a specific task, usually to compute some value or return something useful. Functions are similar to subroutines in many other languages, although they have slightly different purposes. You can use multiple functions inside a program (called nested functions), or pass them to other programs/functions as arguments, just like any other variable.
Classes are data structures. They define variables and methods that are shared among instances of the class. Instances of classes are called objects. Objects are the values assigned to the class' attributes. Attributes are variables that belong to the class, rather than the instance. Methods are functions that belong to the class and are invoked by calling its name.
A list is a sequence of elements. An element may be a scalar (single value) or another list. Scalars are represented by single items in a list. Lists are ordered collections of things.
Strings are sequences of characters. Strings consist of an arbitrary number of bytes, each byte stored in a character. In C, Python, strings are immutable sequences; however, it is possible to create mutable string analogs.
Tuples are unordered lists of values. Each item in a tuple has a unique index. Tuple indices start at 0. Thus the first item in a tuple is indexed by 0, the second item is indexed by 1, etc.
Dictionaries are associative arrays mapping keys to values. Keys must be unique across dictionaries, whereas values can be repeated. Values are accessed through their keys.
A file is a container for information. The data can be read directly from files, or it can be buffered to reduce I/O overhead.
A generator is an iterator object that yields successive numbers, words, tuples, or other iterables. Generator expressions allow these objects to be created declaratively.
Decorators are functions that modify their caller's function definition.
10. Expectation Handling
Exceptions occur when normal execution flow cannot continue. In Python, exceptions are used to signal exceptional conditions in an application. Exceptions are raised, handled, and passed upward as necessary until finally, control returns back to the point where the exception occurred.
Iterating over a collection of objects (list, dict, set,...) produces an incremental output. For example, if we want to print out each letter of a word, we could write the following:
Example showing its use case:
Concurrency occurs when two or more independent tasks are performed simultaneously. Threads are the basic unit of concurrency in Python. If a thread encounters an error, it halts execution until the error is fixed.
Python is a highly interpreted and object oriented programming language. It is the easiest programming language for beginners. You can choose Python as your first Programming language. If you want to start your career as a Python developer you can grab our course of Python and even get upto 90% scholarship just by giving a simple scholarship test.
"Learn Python & become a developer"