string in python

String in Python – Examples and Operations Similar to other programming languages, Python also has a string data type. The string is a class that comes with various useful operations. In this tutorial, we will learn the declaration of strings and various operations with examples. How to declare the string? In python, a string can be declared using single, double …

Read morestring in python

try except and finally

Exception handling in Python with try, except, and finally keywords. The try, except, and finally are the keywords in Python for exception handling. An exception is a runtime error, that causes the program to stop. Why we need exception handling? Exceptions are not the errors put intentionally, neither they are validations. These are the scenarios that are not processed for …

Read moretry except and finally

how to run python script

How to run/execute python scripts? A python program is a script. This means it executes line by line by the interpreter.  Before learning how to execute the program, first, you may download and install python on the machine you are working on. In this tutorial, you will learn how to execute a python script on the Windows and Linux operating …

Read morehow to run python script

Python Operators

Python Operators – All types with examples. An operator is a special symbol that works over variables, values, or other types and returns a result. In this tutorial, you will learn, all types of operators along with examples. What are all types of operators in Python? Arithmetic Operators ( +, – , * etc.) – For basic mathematical operations, add, …

Read morePython Operators

python while loop

Python while loop tutorial A loop provides the capability to execute a code block again and again.  In python, we have two looping techniques.  Finite loop – At the start, we can set the maximum number of iterations along with the condition,  E.g for loop.  Infinite loop – At the start, we can set only a condition. So loop executes …

Read morepython while loop

python for loop

Python for loop – A method to iterate sequence. By using a for loop in Python, You can iterate a body/code block a fixed number of times. The number of iterations depends on the size of the iterable object (such as range, list, tuple, dictionary, or string) passed in the loop. In this tutorial, we will learn how to use …

Read morepython for loop