VARIABLES IN PYTHON

SAIROSHNI



Variables

  • The memory location known as variables is where data is stored.
  • It can hold a value like a container and change its value during execution.
  • When assigning a value to a variable, we use the assignment operator (=).

Types Of  Variable:

  • String
  • Float
  • Long Integer
  • Integer

Python Programming Language:

In contrast to other programming languages, Python does not require you to specify the type of value it holds nor does it have a command to create a variable. When a value is first assigned to a variable, it is created.
              (E.g): Here, input is the variable name.
  • The assignment operator's name is =.
  • It has been given the value of 10.

Rules To Declare A Variable:

  • Every variable name begins with an underscore or alphabet.
  • Numeric names should not be used to begin variables.
  • The name of a variable can only contain underscore (_) and alphanumeric characters (A-Z, a-z, 0-9).
  • The names of variables are case-sensitive.

Right😊Way To Declare A Variable:

  • Beginning with underscores is permitted (first variable=10). Beginning with underscores is permitted.

Ways Not To❌ Follow To Declare A Variable:

  • (first variable=10), the space between the words.
  • Beginning with the number - (78th variable = 10)
  • (first-variable=10, first+variable=10) Special characters are not permitted.
  • Beginning with the number - (third-firstvariable = 10)



More topic in Python

Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send