Python Variables

PREV     NEXT

Python Variables:

  • Variable is nothing but container, it holds some data and one data at a time
  • Single variable hold Single data
  • Most variables have unique names
  • To write the variable names, we can use lowercase (a-z), uppercase (A-Z),numbers(0-9) and underscore _
  • Never use special character while naming variables such as @,$,%.&,! Etc
  • Don’t Start variable name with numbers
  • But, we can use the variable name with the combination of alphabets and numbers
  • Like in other programming language, we can’t declare the variable before going to use that variables
  • So, we can assign the value to variable directly before we are going to use
  • So, there is no concept of declaring a variable in python programming
  • But, we can consider the direct assign value to variable as the variable initialization of that variable

Examples:

Single value Assign to Single Variables:

COMPILE & RUN

Output:

Single value Assign to Multiple Variables:

COMPILE & RUN

Output:

Multiple values Assign to Multiple Variables:

COMPILE & RUN

Output:

PREV     NEXT


Share this website !!!
Facebook Twitter Linkedin