Best Laptop

Browsed by
Tag: Python Tutorial

Python Tuples

Python Tuples

In this tutorial, we will see the use of Python Tuples and how they are different from Python Lists. Tuples are data types that can store more than one element just like lists. In another session, we have already seen Python Lists. Lists are variable types which can store one or more than one element, in fact they can have zero element also. In other words, we can say that lists store sequence of elements which can be accessed using…

Read More Read More

Return statement in Python Function

Return statement in Python Function

In this session, we will be discussing Return statement in Python Function. In our previous two sessions, we understood basics of functions and parameterized functions. Today we will see how we can make a function to evaluate some instruction and return the result back to the function call. To make function return some result, we make use of Python Keyword ‘return’. There are 2 ways to use ‘return’ keyword in a function – using without expression/result and using with expression/result….

Read More Read More

Parameterized Functions in Python

Parameterized Functions in Python

Hi Friends, in previous session we saw an introduction to Python Function. In this session, we will learn about Parameterized Functions in Python. Parameterization is a way of passing data to the function so that the function body use that data and complete the task. Parameters are just simple variables that are defined in function and exist only with the function body. Important Points to remember for Parameterized Functions in Python: • Parameters are defined with the parenthesis present in…

Read More Read More

Functions in Python – Introduction

Functions in Python – Introduction

In this session we will be working with functions in Python. Function is a piece of code that performs a specific task and we can re-use that function any number of times in our code. If we feel that the functionality that we are coding is too long, then its better to decompose the code into multiple parts/smaller functionalities and create functions are around them. For example, if we are building code to create calculator, then as a developer we…

Read More Read More

Python List Comprehension

Python List Comprehension

Hi Friends, welcome to yet another interesting session on Python List Comprehension. Today we will see another way to fill a list with its elements. In previous sessions, we have seen that we can add elements in a list using ‘append’ and ‘insert’ method. However, these methods may not be the best option when you want to add large number of elements in the list since we have add elements one by one. In such cases, there is another way…

Read More Read More

Methods in Python Lists

Methods in Python Lists

Hi Friends……Welcome again to our session on Methods in Python Lists. In the previous session, we had a detailed understanding about Python Lists. We will extend this session now to see how we can make use of the lists and some pre-defined methods and functions to be used with Python Lists. Lets start our session on Methods in Python Lists: 1. sort method on integers – Python Lists provides us with an in-build method to sort the list. Instead of…

Read More Read More

Python Lists

Python Lists

In this session, we will discuss about Python Lists – Uses and Features. So far, we have seen the use of variables which can hold only single value. Like var = 1 or str = ”Python”. These variables cannot hold more than 1 value at  a time. Either we can change their current value, or we must declare more variables. Now imagine a situation where you are writing a program where you would need 100 or 1000 variables. In such…

Read More Read More

Difference between logical and bitwise operator

Difference between logical and bitwise operator

Hi Friends, welcome to yet another session in our Python Tutorial Series. Today we will see the Difference between logical and bitwise operator in Python. We have already seen mathematical operators in Python in another session: Lets see below logical and bitwise operators one by one: Logical Operator: Logical operators return the logical output of the expression on which the operator is applied. The answer can be either True/False or 1/0. Below are the logical operators: and operator – This…

Read More Read More

break and continue statement in Python

break and continue statement in Python

In this session, we will see the use and functionality of break and continue statement in Python. ‘break’ and ‘continue’ are the statement that are used to change the course of ‘for’ and ‘while’ loops. In other words, you can control the execution of these loops using break and continue. They are the Python reserved keywords and you cannot use them for naming user defined variables or functions. break – There might be some situation where you want to exit…

Read More Read More

for loop in Python

for loop in Python

Hi Friends…lets continue our Python Tutorials journey with ‘for loop in Python’. Python for loop is used is when we want to iterate over an activity more than one time.Although while loop also does the same thing but we use for loop, when we know the number of times we want our loop to execute. In while loop, we are not sure how many times we want to execute; the loop continues till the condition is True. Also, in for…

Read More Read More

Python 3.11.1 Features