Learn Python – variable

I am planning to learn python. So to go through official docs or any python learning book. I have extracts few things which are basics and must to write code in python. I will post each one by one.

Let me start with Variables. They  vary and their ability is always visible in any programming language.
In python declaring variable is just variable name and it’s value

So if I want Integer 10 in variable score then I will write

score = 10

For String “Nikhil Gohil” in variable name, then

name = “Nikhil Gohil”

For Float 11.11 in variable duration, then

duration = 11.11

For Boolean true in variable is_developer, then

is_developer = true

Now, suppose we don’t know the exact value for variable and want to declare it for later use then we can assign None. I found it from this stack overflow thread.

https://stackoverflow.com/a/664297/855261

variable_name = None

Oh! So like other languages I can assign multiple variable too.

first_name = last_name = address = None

Isn’t it simple? It is. 👌🏻

I will post my another extract in next post. 🙃


Also published on Medium.

Leave a Reply

Your email address will not be published. Required fields are marked *