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.

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:

 


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


  • 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.

 

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?

Suryateja Pericherla

Suryateja Pericherla, at present is a Research Scholar (full-time Ph.D.) in the Dept. of Computer Science & Systems Engineering at Andhra University, Visakhapatnam. Previously worked as an Associate Professor in the Dept. of CSE at Vishnu Institute of Technology, India.

He has 11+ years of teaching experience and is an individual researcher whose research interests are Cloud Computing, Internet of Things, Computer Security, Network Security and Blockchain.

He is a member of professional societies like IEEE, ACM, CSI and ISCA. He published several research papers which are indexed by SCIE, WoS, Scopus, Springer and others.

Leave a Reply

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