We Offer 100% Job Guarantee Courses (Any Degree / Diploma Candidates / Year GAP / Non-IT / Any Passed Outs). Placement Records
Hire Talent (HR):+91-9707 240 250


Python Variables

Python Variables

Python Variables

The main difference between python variables and other languages is the absence of command for declaring a variable.

  • Storage box or container to store value
  • Dynamically Typed
  • Variable declaration – Not required
  • Automatic data type assignment

Rules for variable creation

  •  You cannot start with a letter or underscore character.
  •  Cannot start with numeric or integer value.
  • May contain letters, numbers or its combination (alpha-numeric characters) and underscore (A-Z, a-z, _, and 0 up to 9).
  • Variable names are case-sensitive Eg: name, Name, and NAME are three different variables).
  • Reserved words or keywords cannot be used as a variable.

Possible Formats

String/Character, Integer, Floating point values, Boolean.

How Does + Operator Work With Variables?

Plus Operator Work With Variables

Assigning Different Values to Multiple Variables

Example 1:

Assign Different Values to Multiple Variables

 Example 2:

Different Values to Multiple Variables Example Program

Can We Use the Same Name For Different Types

If We use the same name, the variables start referring to new value and type.

Same Name For Different Types


Click Here-> Get Python Interview Questions and Answers

Besant Technologies WhatsApp