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
  • Pega testing training
    PEGA Testing Training
  • Today application testing is the deciding factor to launch the application into the market. And people do not launch the application unless it goes true.

  • blockchain course
    Blockchain Online Course
  • Today many people were enthusiastic, to know the exact details of things happening around him. This can get the proper knowledge on Blockchain.

  • ethical hacking course
    Ethical Hacking Certification Course
  • Zeal to learn ethical hacking is common among college students and IT professionals. Because everybody wants to secure their system from cyber attacks.

  • python training
    Python Online Training
  • Python is a dynamic interrupted language which is used in wide varieties of applications. It is very interactive object oriented and high-level programming language.

  • Tableau Training
    Tableau Training
  • Tableau is a Software company that caters interactive data visualization products that provide Business Intelligence services. The company’s Head Quarters is in Seattle, USA.

  • what is pega
    PEGA Online Training
  • Pega Systems Inc. is a Cambridge, Massachusetts based Software Company. It is known for developing software for Customer Relationship Management (CRM) and Business process Management (BPM).


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