#________________VARIABLES IN PYTHON_________________
variables are containers for stroring values
for example: In homes you have a water tank to store water and
a food item in a packet of some sort
python has different containers for storing different
values. These are:
int (short for integer): stores negative and positve whole numbers
float (decimal number): stores negative or positve decimal numbers
str (short for string): stores text inside quotes
bool (short for boolean): stores either True or False
To declare a variable, name it anything you like and set its value
to any variable type using the '=' symbol. You can print the
variable by simply placing the variable name inside the print statement
without using any quotes.
exmaple:
name = "dhruvix"
print(name)# this will display the value of the variable
things to remember :
never use quotes for values other than str
int values do not store decimal values
bool values store only 2 values- 'True' or 'False'
type function returns the type of a variable
exmaple:
num = 123
data_type = type(num)
print(num) # you could store the returned value
in a variable or directly print it
print(type(num)) # both would work the same
name = "Dhruvix"
num = 24
true_or_false = False
decimal_number = 3.14159
print(name)
print(num)
print(true_or_false)
print(decimal_number)#________________VARIABLES IN PYTHON_________________
variables are containers for stroring values
for example: In homes you have a water tank to store water and
a food item in a packet of some sort
python has different containers for storing different
values. These are:
int (short for integer): stores negative and positve whole numbers
float (decimal number): stores negative or positve decimal numbers
str (short for string): stores text inside quotes
bool (short for boolean): stores either True or False
To declare a variable, name it anything you like and set its value
to any variable type using the '=' symbol. You can print the
variable by simply placing the variable name inside the print statement
without using any quotes.
exmaple:
name = "dhruvix"
print(name)# this will display the value of the variable
things to remember :
never use quotes for values other than str
int values do not store decimal values
bool values store only 2 values- 'True' or 'False'
type function returns the type of a variable
exmaple:
num = 123
data_type = type(num)
print(num) # you could store the returned value
in a variable or directly print it
print(type(num)) # both would work the same
name = "Dhruvix"
num = 24
true_or_false = False
decimal_number = 3.14159
print(name)
print(num)
print(true_or_false)
print(decimal_number)#________________VARIABLES IN PYTHON_________________
variables are containers for stroring values
for example: In homes you have a water tank to store water and
a food item in a packet of some sort
python has different containers for storing different
values. These are:
int (short for integer): stores negative and positve whole numbers
float (decimal number): stores negative or positve decimal numbers
str (short for string): stores text inside quotes
bool (short for boolean): stores either True or False
To declare a variable, name it anything you like and set its value
to any variable type using the '=' symbol. You can print the
variable by simply placing the variable name inside the print statement
without using any quotes.
exmaple:
name = "dhruvix"
print(name)# this will display the value of the variable
things to remember :
never use quotes for values other than str
int values do not store decimal values
bool values store only 2 values- 'True' or 'False'
type function returns the type of a variable
exmaple:
num = 123
data_type = type(num)
print(num) # you could store the returned value
in a variable or directly print it
print(type(num)) # both would work the same
name = "Dhruvix"
num = 24
true_or_false = False
decimal_number = 3.14159
print(name)
print(num)
print(true_or_false)
print(decimal_number)
Nesta página do site você pode assistir ao vídeo on-line Python Tutorial #2: variables duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Dhruvix 24 18 Abril 2022, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 20 vezes e gostou 1 espectadores. Boa visualização!