My Channel

Python Coding Series:Episode 3: Variables | What are Variables?

 Python Coding Series:

Episode 3: Variables

Hi guys, Welcome back to Series and today we will see what is Variables in Python. So stay tuned to learn about it.

What are Python Variables?

Python has several variables, i.e, You can have anything you want for example a,b,c.

These Variables are something that we use to define or assign our values to it. 

Eg: A = "Hello, World!"

These values when printed shows the assigned value and not themselves.

Eg: A = "Hello, World!"

      print(A)

This syntax will print A's assigned value and not A because we didn't have an apostrophe There.

These Variables are used to allocate memory for the values assigned to them. The computer saves some memory so it could be executed whenever needed or later on in the program.

There are some rules to be followed while creating a variable:

  • Variables can only start with a letter or an Underscore.
  • A number cannot be called a variable. We cannot start a variable with a Number but can have numbers in the middle or the end.
  • A variable name should only contain Alpha-numeric Characters and Underscores.
  • Variable names are Case-Sensitive. Eg: Variable, variable and VARIABLE are three kinds of Variable names. This Case-sensitive Rule can be helpful as it gives a lot of names to choose from.
  • The keywords such as 'if, int, str, float, else(These will be taught later on an episode) etc. cannot be used in naming a variable.

So, hope you understand why we use a variable and its uses and rules. Now I repeat, a variable is assigning a value to a specific name.
Eg: A = "Hello, World!"

Hope you enjoyed the Episode and Be sure to be tuned in to learn more in Python.



Question Time: What is the Syntax for printing? Tell the answer down in the comments.

Until Then, Bye!

By the Blog Author

Post a Comment

0 Comments