Posts

Showing posts from February, 2023

Featured Post

Beginner's Guide On For Loop in Python

Image
  Beginner's Guide On For Loop in Python Introduction This post is for beginners who are trying to learn Python and they will find this step-by-step guide very easy to understand.  Here, I will be first introducing the concept of the 'for' loop in Python, and thereafter, I will proceed to explain the significance and methods of using this loop in your Python projects with several easy-to-understand examples and source code.   What is a 'for' loop A 'for' loop in Python is used to loop over a sequence and it is very useful when you perform tasks in your python functions. The 'for' loop could be used for looping or iterating over a list, tuple, set, dictionary or a string. We will see the examples below. During the phase of looping through a list for example, after creating the variable name to specify each item in the list, we will decide what is the action that is to be executed in the phase of this iteration whereby each and every item s...

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...