Posts by Deepak Jangra

How to create a variable in Python

Hello there, in this post we are going to learning about creating a variable in Python. The process is very simple like creating a variable in other languages but if you are new to programming don’t worry I’ll explain each step in details.

What is Python variable:

A Python variable is used to store some information/value that we can use in our program. It can be anything; a number, string, function, or a variable itself.

Well, this is how a Python variable look like:

website = "Pythonologia"

Let me explain you what just happened above.

The “website”word called as variable name and “Pythonologia” in strings (“double quotation marks”) called as string.

Python variable name: Python variable name can be anything and whatever you want like my name, your name, age, account, and so on. But it can’t be start with numbers like 1website it should start with a alphabet.

Moreover, here are valid types of a Python variable:

  • website1
  • web-site
  • web_site
  • web1site

Invalid types of Python variable:

  • 1website
  • $website
  • website$

I mean other than above mentioned valid types of a variable are invalid.

So, now I am assuming you know what is and how to write variable name. Now, let us look at other part.

The other part called as variable value. It can be anything a number, stings (words), function, and variable itself. Just you need to know how store them correctly.

How to store a string:

A string always entered between the double quotation marks. And it can be number and words. If you store something between quotations than it will become a string.

website = "Pythonlogia"

mynumber = "342"

How to store a number:

A number can be store without quotation marks.

mynumber = 321

How to store a Python variable in Python variable:

You can store like string but without using quotation mark.

newwebsite = oldwebsite

Now, that newwebsitevariable has same value like oldwebsite variable.

I hope you learned how to create a variable in Python. If you have any question or suggestion than feel free to ask in comments.

How to install LEMP stack on Digital Ocean

Hello and welcome everybody. I’m Deepak and today we are going to looking at How to install LEMP stack on Digital Ocean.

Before installing LEMP stack on Digital Ocean you must have an Digital Ocean account. For creating the Digital Ocean account. Visit this link and sign up there by using this link you will get $100 free credit for 2 months that means you can use a live hosting for free for 2 months.

Disclaimer: The link mentioned above is an affiliate link. It will help Pythonologia to continue making the free stuff 😉

Now, I’m assuming you have your account ready! So, lets get jump into the LEMP stack installation process.

There are two ways to install but in this article we are using simplest way to do the things!

First of, click on the “Create” button and choose the “Droplets”.

Next, click on the “Marketplace”

Next choose the “LEMP on 18.04” don’t get confused with “LAMP on 18.04”. We have to select the “LEMP on 18.04”, this 18.04 might be update when you’re reading this article just remember choose LEMP.

Scroll down and select your prefered plan in my case, I am using the $5 a month.

If you wish you can add addons which will cost you a bit extra but one thing, I highly recommend is to “enable backups”. You already the importance of backups.

Then choose the prefered datacenter, where your most of users comes from.

Then scroll down to the bottom and name your droplet. I’m using testlemp

And then hit “Create” and that it. The server will start installing the droplet in your account. It will take a while.

You will receive your droplet username and password on your email address and you are ready to go!

If you have any question or stuck at somewhere, do let me know in the comments. I will be more than happy to help you there!