Python Variables

Python Variables are nothing but the reserved memory locations to store the values. In other words, it is the name of the memory location where the data is stored. And if once the variable is stored a separate space is allocated in the memory.  Moreover, we can define the variable name using the combination of letters, number, and underscore.

Click the here to know the programming structure of python

Assigning values to the variables :

In fact, there is no explicit declaration to store the memory. And we can easily define a variable using the ‘=’operator.

Example :

a = 20

b = 30

print a

Output:

20

 Beside python online training suggest another type of declaring the variables.

Example :

a,b,c = 2,10,python

Note :

Python interpreter automatically identifies the types of variables

Can we re-declare a variable?

Today many starters have this question?   Hope you got the answer after reading this. And the answer to the question is yes, we can re declare a variable. But the Variable stores the most recent value.

Ex :

x  = ‘10’

Print(‘x’)

X=’abc’

Print(‘x’)

Output :

10

abc

Constants:

These are fixed values that cannot be altered.

Ex : pi= 22.7

Gravity =9.8

Place these values separate files like constant.py

Now we can execute this by the following command

Import constant

Print(constant.pi)

Print(constant.gravity)

So after running this command, we would get the following output

Output :

22.7

9.8

Willing to get certified on it Courses? Visit OnlineITGuru for Online Certification Courses

So till we seen the variable types, declarations. Now,  its time to discuss tokens

Subscribe
to our newsletter

Drop Us A Query

Trending Courses
  • Selenium with python
    Selenium with Python Training
  • As we know, that Selenium with Python Web Browser Selenium Automation is Gaining Popularity Day by Day. So many Frameworks and Tools Have arisen to get Services to Developers.

  • Deep learning course
    Deep Learning Course
  • Artificial Intelligence, Deep mastering (DL) is completely about, many levels of Representation and sort of abstraction. That guide to design a sense of Information like Images, sound and text format.

  • machine learning with python
    Machine Learning with Python Training
  • Over last few years, Big Data and analysis have come up, with Exponential and modified Direction of Business. That operate Python, emerged with a fast and strong Contender for going with Predictive Analysis.

  • Data science with R
    Data Science With R Training
  • Understanding and using Linear, non-linear regression Models and Classifying techniques for stats analysis. Hypothesis testing sample methods, to get business decisions.

  • data science with python
    Data Science with Python Training
  • Everyone starts Somewhere, first you learn basics of Every Scripting concept. Here you need complete Introduction to Data Science python libraries Concepts.

  • devops with azure
    Devops with Azure Training
  • As we Know Azure DevOps is a Bunch of Services, in guiding Developers. It contains CI/CD, pipelines, code Repositories, Visual Reporting Tools and more code management with version control.


100% Secure Payments. All major credit & debit cards accepted.