Python – types of variables

Alright, so today I learnt there are 4 types of variables which can be assigned. Assigning a variable is using the Equal (=) to assign any value.

Variables can only start with letters or an underscore (_), starting with numbers are invalid.

Examples

string1 = “Hello World”

integer1 = 200

float1 = 203.1

The example is for Integer type

You can try it this way too.

The boolean data type can have one of two values, True or False. We use an assignment operator = to assign a boolean value to variables in a manner similar to what we have seen for integer and float values.

Example

TimeisPrecious = True

TimeisMoney = False

print(TimeisPrecious)

It will give you True.

Hello World – My first python project

Hello World has become the norm for beginners learning programming. So this is also my first time learning Python, which I got impressed when my ex-colleague coded a Python script for me as a project. The project is able to extract all data from Excel spreadsheets and combine them into 1 excel sheet and perform data analytics using PowerBI Dashboard. The script completes in a minute even with over 40 excel files. I am impressed and this is the reason I want to learn Python.

So to kickstart the learning journey, first install the Python 3.10.0 into your computer.

https://www.python.org/

If you are a Windows user, click on the “Windows” link.

Once installed successfully, you will see this in your MAC

You can launch the IDLE and the shell will launch for you to test out the commands.

So let’s try out some scripting as a beginner myself. The first command is to use the “print” function to print out any output.

print(“Hello World”)
print(“Welcome to my first Python Project”)

Or you can assign a value to a variable like below and print out the output.

string1 = “Hello World”
print(string1)

So if you have any projects in mind which is simple, you can try out on your own in Python. So next post, I will share about the different types of variable like integer, float etc.

SUmmary

Assign variable – string1 = “Hello World”

print function