Python Tutorial #2: variables

Published: 18 April 2022
on channel: Dhruvix 24
20
1

#________________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)


On this page of the site you can watch the video online Python Tutorial #2: variables with a duration of hours minute second in good quality, which was uploaded by the user Dhruvix 24 18 April 2022, share the link with friends and acquaintances, this video has already been watched 20 times on youtube and it was liked by 1 viewers. Enjoy your viewing!