Posts

Showing posts from April, 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...

Working with files in Python

Image
WORKING WITH FILES IN PYTHON INTRODUCTION In this Python tutorial, you will learn how to work with files, that is, how to read and write files using python programming. Consider the code in source file as shown below. I have used the repl.it code editor to code. Python is a very powerful language and as you will learn in the following passages, how it is possible to open, read, write and make changes to created other files using our python script in the main.py file. For the purpose of this lesson, we will be using several in-built python functions such as open(), read(), write() and append() functions while explaining the two examples provided below to demonstrate how python handles files. The code editor that I have used for this purpose is the most popular cloud editor Replit  and you can easily find it from the source code that I have included at the end of this post. Code Example 1 my_file = open("index.html","w") my_file.write("<p> HELLO WORLD, th...

Build A Calculator in React

Image
  Build A Calculator in React This project is part of the freeCodeCamp react certification program. In this React Project tutorial, we will learn how to build a simple calculator using JavaScript React framework.  TASKS TO ACHIEVE IN THE PROJECT The calculator should contain clickable element with an  'Equal to'  sign (that is, an = symbol )  which has an id of "equals". There should be ten clickable elements having one number each from 0-9 with the following corresponding IDs :  id="zero", id="one", id= "two", id="three", id="four", id="five", id="six", id="seven, id="eight" and id="nine" There will be four clickable elements each having one of the primary mathematical operators with the following corresponding IDs:  id="add', id="subtract", id="multiply", id="divide". T here will be one clickable element with a decimal point  symbol w...