Startertutorials Blog
Tutorials and articles related to programming, computer science, technology and others.
Subscribe to Startertutorials.com's YouTube channel for different tutorial and lecture videos.
Home » Programming » Python Programming » Variables in Python Programming
Suryateja Pericherla Categories: Python Programming. No Comments on Variables in Python Programming
0
(0)

In this article we will learn about creating and naming variables in Python programming language along with examples.

 

What are Variables?

Variables are just names of memory locations. Variables are used to store and retrieve values from memory. Type of the variable in Python is based on the value we assign to the variable.

 

Variable Naming

In Python, names come into existence when you assign values to them, but there are a few rules to follow when choosing names for the subjects of your programs:

 

  • Names must start with a letter or underscore and can be followed by any number of letters, digits, or underscores.
  • Special symbols are not allowed in names.
  • Names are case sensitive.
  • Names cannot be reserved words.

 


Subscribe to our monthly newsletter. Get notified about latest articles, offers and contests.


Creating and Using Variables

Syntax for creating a variable is as follows:

 

Variable-name = value

 

Consider the following example which creates a variable named x and assigns the value 10 to it:

 

x = 10

 

Learn more about variables in Python through the following resources:

How useful was this post?

Click on a star to rate it!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Leave a Reply

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

Facebook
Twitter
Pinterest
Youtube
Instagram
Blogarama - Blog Directory