#________________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)
In questa pagina del sito puoi guardare il video online Python Tutorial #2: variables della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Dhruvix 24 18 aprile 2022, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 20 volte e gli è piaciuto 1 spettatori. Buona visione!