Posts

Showing posts from February, 2023

Featured Post

How To Use While Loops In Python

Image
How To Use While Loops In Python Overview  This beginners Python guide will explain the steps for working with 'while' loops in Python for beginners. Introduction  The Python while loops help to execute a set of statements in Python functions,  as long as a particular specified condition is True. Let us understand the while loop with a simple python example exercise, of a while loop usage, where we are trying to count numbers from 1 to 10, with a condition of the number being less than 10. We create a variable called num, and initiate it with a initial value of 1 and we carry out iteration of this num variable, whereby, it is incrementing every time it loops, by incrementing by 1.  Code num = 1 while num < 10 :       print(num)       num += 1 # output   1 2 3 4 5 6 7   8  9 In the above case, we performed iteration of the while loop where every time the loop iterates, the num variable gets incremented by 1 a...

A Simple Guide to Python Lists

A Simple Guide to Python Lists What are Lists  Lists in Python are built-in data structures to store items in a specified order. Lists store multiple items in a single variable. Sometimes, they could also be not carrying any item, that is, they could be empty as well.  Let us delve deeper into the concept of lists, how they are created and what methods we can perform with lists. Define Lists  Lists are built-in data structures  in Python, that store multiple items with a specified order, in a single variable. How to Create a List To create a list, for example , below, we use a variable called names and store all strings, namely, "Jay", "Ann" and "Alan" using the square brackets and then we run the print command. We also consider another variable numbers storing numbers 1,2,3  as shown below. names = ["Jay","Ann","Alan"] print(names) numbers = [1,2,3] print(numbers)   What are List Items The list items could be o...