Python is a widely used high-level programming language used for general-purpose programming, created by Guido van Rossum and first released in 1991. An interpreted language, Python has a design philosophy which emphasizes code readability (notably using whitespace indentation to delimit code blocks rather than curly braces or keywords), and a syntax which allows programmers to express concepts in fewer lines of code than possible in languages such as C++ or Java.The language provides constructs intended to enable writing clear programs on both a small and large scale.
Python Control Statement
In general, statements are executed sequentially: The first statement in a function is executed first, followed by the second, and so on. There may be a situation when you need to execute a block of code several number of times.Programming languages provide various control structures that allow for more complicated execution paths.A loop statement allows us to execute a statement or group of statements multiple times.The if statement in python is same as c language which is used test a condition. If condition is true, statement of if block is executed otherwise it is skipped.When we need to check for multiple conditions to be true then we use elif Statement. This statement is like executing a if statement inside a else statement.for Loop is used to iterate a variable over a sequence(i.e., list or string) in the order that they appear.while Loop is used to execute number of statements or body till the condition passed in while is true. Once the condition is false, the control will come out of the loop.
Python is an object-oriented programming language. You can easily create and use classes and objects in Python. Major principles of object-oriented programming system are given below: Object, Class, Method, Inheritance, Polymorphism, Data Abstraction and Encapsulation.Python is an object oriented programming language. So its main focus is on objects unlike procedure oriented programming languages which mainly focuses on functions.In object oriented programming language, object is simply a collection of data (variables) and methods (functions) that act on those data.A constructor is a special type of method (function) that is called when it instantiates an object using the definition found in your class. The constructors are normally used to initialize (assign values) to the instance variables.
Strings are the simplest and easy to use in Python.String pythons are immutable.We can simply create Python String by enclosing a text in single as well as double quotes. Python treat both single and double quotes statements same.1).Python lists are the data structure that is capable of holding different type of data. 2).Python lists are mutable i.e., Python will not create a new list if we modify an element in the list. 3).It is a container that holds other objects in a given order. Different operation like insertion and deletion can be performed on lists. 4).A list can be composed by storing a sequence of different type of values separated by commas. 5).A python list is enclosed between square() brackets. 6).The elements are stored in the index basis with starting index as 0.A tuple is a sequence of immutable objects, therefore tuple cannot be changed. The objects are enclosed within parenthesis and separated by comma.