PYTHON

print() | Python

The print() function prints the given object to the standard output device (screen) or to the text stream file. Syntax of print() print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False) where objects - object to the printed. * indicates that there may be more than one object sep - objects are separated [...]

2019-10-06T19:43:58+05:30Categories: Programming|Tags: |

Variable and Scope | Python

Introduction Not all variables are accessible from all parts of our program, and not all variables exist for the same amount of time. Where a variable is accessible and how long it exists depend on how it is defined. We call the part of a program where a variable is [...]

2019-10-06T19:21:03+05:30Categories: Programming|Tags: |

File Handling in Python

Introduction Python has in-built support for file handling. It allows users to handle files i.e. to read and write files, along with many other file handling options, to operate on files. There are always two parts of a file in the computer system, the filename and its extension. Also, the [...]

2020-09-08T15:46:38+05:30Categories: Programming|Tags: |

Date and Time Manipulation in Python

Introdcution Datetime module in Python supplies classes for date and time manipulation. Commonly used classes in the datetime module are: date Classtime Classdatetime Classtimedelta Class Below example gets the today's date and time. import datetime # Current Date and Time object = datetime.datetime.now() # Today's Date date = datetime.date.today() Date [...]

2020-09-08T18:15:51+05:30Categories: Programming|Tags: |

Inheritance | Python

Introduction In inheritance an object is based on another object. When inheritance is implemented, the methods and attributes that were defined in the base class will also be present in the inherited class. This is generally done to abstract away similar code in multiple classes. The abstracted code will reside [...]

2019-10-05T19:29:52+05:30Categories: Programming|Tags: |

Classes and Objects | Python

Introduction Python is an object oriented programming language. Unlike procedure oriented programming, where the main emphasis is on functions, object oriented programming stress on objects. An object is also called an instance of a class and the process of creating this object is called instantiation. Attributes of class are data [...]

2019-10-05T18:42:21+05:30Categories: Programming|Tags: |

Enumerate Function in Python

Enumerate is a built-in function of Python. It allows us to loop over something and have an automatic counter. Enumerate() method adds a counter to an iterable and returns it in a form of enumerate object. This enumerate object can then be used directly in for loops or be converted [...]

2020-09-15T10:35:01+05:30Categories: Programming|Tags: |

Loops | Python

Introduction Python provides following types of loops to handle looping requirements while loop for loop   while loop While Loop is used to execute a block of statements repeatedly until a given a condition is satisfied. And when the condition becomes false, the line immediately after the loop in program [...]

2019-10-04T22:13:01+05:30Categories: Programming|Tags: |

Conditional Statements | Python

Conditional statements are also known as decision-making statements. We use these statements when we want to execute a block of code when the given condition is true or false. One can achieve decision making by using the below statements: If statements If-else statements Elif statements Example num = -7 if [...]

2019-10-04T21:29:16+05:30Categories: Programming|Tags: |

Functions in Python

Introduction A function is a set of statements that take inputs, do some specific computation and produces output. The idea is to put some commonly or repeatedly done task together and make a function. Python provides built-in functions like print(), etc. but we can also create your own functions. These [...]

2020-09-15T15:41:03+05:30Categories: Programming|Tags: |
Go to Top