Posts

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

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