NO Worry! Update will be here.

need to check more


  • EdverseXplore
  • Oct 22, 2024
  • Entrance Exams

Need to check more

Variable are containers that store information that can be manipulated and referenced later by the programmer within the code. 

In python, the programmer does not need to declare the variable type explicitly, we just need to assign to assign the calue to the variable.

Example:

name = "Abdullah"    #type string

age = 20                 #type int

It is always advisable to keep names descriptive and to follow a set of convention while creating varaibles:

  • Variable name can only contain alpha-numeric characters and underscore (A-z, 0-9, and _ )
  • Variable name must start with a letter or the underscore character.
  • Variable are case sensitive.

Example:

Color = "yellow"  #valid variable name

cOlor = "red"       #valid variable name

_color = "blue"    #valid variable name

 

5color = "green"  #invalid

$color = "blue"     #invalid

 

Comments (0)

Add a comment