Categories
Python Programming

Variables and Data Types

As I see it, the purpose of programming is to build machines out of bytes that are impossible or too expensive to build out of atoms. Computers are machines that can imitate any other machine. Programming is the act of making them do that.

Eric Hodges

From the above quote, we can see that a computer is a universal machine.

As we begin the journey of learning how to program on this site, the following characteristics of universal machines will shape the content for this training.

  1. A way to keep track
  2. A way to make decisions
  3. A way to keep going

We achieve the first feature by using variables. The second feature is implemented using branching while the third feature is implemented using loops.

This post will focus on variables. Variables are a container for information, they are used to store values in a program.

The way variables are created in the Python programming language is similar to how they are treated in algebra.

if x = 6, what is x?

If you know algebra, you would answer 6 and you would be right. Like in algebra, the = symbol is for assignment. It assigns the value on the right to the value on the left.

A variable is created the moment you assign a value to it. Once we assign a value to a variable, the Python interpreter creates it.

In the last post about Input and Output, a variable name was created when the input from the user was assigned to it.

Like containers in the real world, the type of material a container is made out of determines what kind of material it can store. In computing, this is the concept of data types.

In the Python programming language, we have 5 standard data types:

  1. Numbers
  2. String
  3. List
  4. Tuple
  5. Dictionary

For this program, we shall only look at numbers. However, I will illustrate Numbers and Strings in this blog post.

We have two types of numbers in computing: integers and decimals. Integers are whole numbers while decimals have a . in them for example, 1 is an integer while 1.0 is a decimal.

Strings are a sequence of characters. Your name is a sequence of characters. Strings are placed in the “”.

The type function will let you know the data type of the variable passed into it. The code below will illustrate the concept in action.

Data Types in Python

The above image shows that in the first 3 lines we declare the respective variables. Do bear in mind that the variable names are for you, not the users.

Once we use the type function, notice that it gives us the type each variable. The decimal variable is depicted as a float.

Content and Context

Content and Context

This is a very important concept when choosing the data type of a variable. The “label” of a variable is different from its content.

As a result of this, you cannot declare the phone number of a user as either an integer or a float because you cannot add two phone numbers together.

Rather you would define them as a string. As seen in the blog post on Input and Output, you have to convert a number to a string before you can join it to it.

This is important as we continue on our journey.

Learn Python in One Week

If you want a quick and easy introduction to the Python programming language, you should check out my fifth book: Learn Python in One Week on the Amazon store.

Categories
Make Money Online

5 Ways to Make Money During the Coronavirus Lockdown in Nigeria

On Sunday the 29th of March, after months of being silent, the Nigerian President finally addressed the nation. Starting from 11 pm yesterday, there will be a ban on movement in Lagos from 11 pm. The ban will last for the next 2 weeks.

This post will look at 5 ways to make money during the lockdown in Nigeria. Due to the restriction on movement, these methods have to of necessity be methods of making money online.

The criteria for the selection of these methods are based on my personal belief that they can be set up within the period of the lockdown.

So if today, you started work on any of the 5 methods, by the end of the lockdown, you should have made money online even if you haven’t done so before.

Virtual Classes

If you have a skill, the easiest way to monetize that skill right now is to offer one on one classes with your students.

This will involve agreeing on a time with your students and meeting up with them at that time.

To avoid them missing classes, you as a teacher must define your method of communication with your students beforehand and send reminders before the classes start.

Technology: WhatsApp Video, Zoom.

Online Freelancing

If you have a skill, you can make money in this period by working online as a freelancer.

There a number of skills in demand. The key here is to look for the skill or talent that you are most passionate about start with that.

Passion cannot be overlooked here because you will be competing with people from all over the world.

Freelancing Marketplaces: Fiverr, Upwork.

Write and Publish an eBook

You can write an publish an eBook for sale in 2 weeks if you would cut out all distractions and focus.

It would be hard because writing is hard but at the end of the period, you would have a book to your name.

Once you finish writing, you can sell the books in an online marketplace.

Online Marketplaces: Amazon, Okadabooks.

Create and Sell Online Courses

In this case, you are automating your virtual classes to operate without your presence.

Online courses consist mainly of videos so you would have to find a means to create them.

If you have a very good smartphone camera, that could suffice if you wanted to show your face. If you decide not to, you could use screencasting software to record your screen as you work through your content.

Technology for Video Production: Open Broadcast Software, Movavi.

Sell Graphics Design

This story should inspire you on what is possible with the creation of digital designs.

If you can design items that people can print at home, you can make this happen for you.

Technology for Selling: Etsy, Shopify.

This period of lockdown will be a time unprecedented in the history of our country.

Do make the most of it by assessing where you are and realigning yourself to meet your goals.

PS

If you would like to learn how to code for free during the month of April, please check out the “Learn to Code Monthly Series”.

It is a group on Telegram where I teach absolute beginners how to program using the Python programming language.

Click here to join.

Categories
Uncategorized

Lockdown in Lagos

The above picture isn’t from a war scene. It is from an explosion that occurred in the Abule Ado area of Lagos State on the 15th of March.

Amidst the crying and pain from the event, there was more to come in the month of March as the Coronavirus kept spreading in the state.

As a result of this, a lockdown was declared by Lagos state. Then after a broadcast by the President of Nigeria, a new lockdown was declared in the state.

The absence of leadership from the center has been very glaring. At the end of the day, after being roused to action by clamours on social media, the broadcast happened.

Tomorrow will be the first day of the Lockdown. Bad governance will kill everyone.

Categories
Lockdown Chronicles

Lagos Lockdown

After months of Nigerians clamouring that the President should address the nation, yesterday the address finally came.

At the end of the address, the President would place a curfew on Lagos, Abuja and Ogun states.

Today, like in all the countries where the Presidents give addresses, the panic started.

ATMs where filled with long queues as people wanted to stock up on cash. Petrol stations would witness a rush as people needed to stock up on fuel.

In Nigeria, power cuts are an everyday reality. My family had already stuck up on food so I had to buy fuel today. I would buy more that I normally did because my sister would drive me to the petrol station.

Somehow, some of the fuel poured out as the car was bringing it back home.

Now I am ready for the lockdown. I will be posting everyday. This whole saga was poorly handled.

As a nation, we had 50 years to prepare for this but sadly we failed woefully.

The Lockdown will start today at 11 pm. Let the Lockdown begin.

Categories
Uncategorized

Where is Buhari?

Too much emphasis on actions that yields photo ops, heavily laden with noise, generating impacts with zero signal/substance.

Emeka Okoye

President Buhari himself has not been seen in public since March 19 when he made a brief appearance at a gathering to commission federal emergency telephone lines in Abuja. His failure to publicly address a nation in crisis has fuelled rumours about his health.

His media aides have, however, continued to issue statements attesting to his firmness, saying his silence at a time leaders across the world are vigorously providing leadership and guiding their people was deliberate.

On March 22, a 23-second video purporting to show the president talking about the coronavirus was abruptly deleted after exposing him as being unable to pronounce COVID-19, one of the most used words in the world.

At a time when the President is needed, he is missing in action. Last week, I took a position that we didn’t have a President in Nigeria. Time has proven me right.

Nigeria Receives Test Kits and Protective Gears Donated By Jack Ma

Last week, Nigeria took receipt of materials from Jack Ma. In a clear display of Federal Character, they were disbursed to Abuja rather than Lagos which is at the epicenter of the pandemic.

Toyota Camry 2020

Although there was no money to pay for testing kits, the Senators got their 2020 Toyota Camrys delivered to them.

The tragedy of Nigeria isn’t the lack of resources but the lack of a clear definition of priorities.

Leadership Style

This isn’t a good time to be a media handler to the President. The past week saw the Special Adviser to President Muhammadu Buhari on Media and Publicity, Femi Adesina defend the President’s refusal to address the nation.

The standards of leadership in Nigeria have been buried. A style of leadership of incompetence leading to tragedy is now the norm in Nigeria.

Later on, pictures of the President would be released online. They would be torn apart on Twitter.

Thanks to that leadership style, Nigeria has come under attack by the Imam of Peace. If you want truth in times like this, the Imam of Peace is a veritable source of truth.

Abba Kyari Admitted at London’s Hospital

Proving that the failure to deliver healthcare facilities in the country is the ultimate failure, the Chief of Staff of President Buhari, Abba Kyari has been admitted into a London hospital.

Akure Explosions

A vehicle carrying explosives caused a blast in Akure. If you believe in the tooth fairy, you would also believe that the company in question doesn’t have a name.

As COVID-19 Makes A Landfall In Nigeria, By Chidi Anselm Odinkalu

This opinion piece pretty much sums up all the fears about the Coronavirus in Nigeria.

It highlights the biggest danger at this time which is a leadership vacuum in the nation.

As of today, most governors are stepping into the gap to lead their states.

The silence of the President is making a loud sound. It is my hope that this crisis passes.