#________________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)
Auf dieser Seite können Sie das Online-Video Python Tutorial #2: variables mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Dhruvix 24 18 April 2022 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 20 Mal angesehen und es wurde von 1 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!