Flow_0bngcu2
Flow_0bngcu2
# Creating Variables
age = 51 # This is an integer
height = 1.93 # This is a float or "floating point number"
children = ['Robert', 'Edward', 'Tad', 'Willie'] # This is a list
is_married = True # This is a boolean
# Updating Variables
Age = 50 # Variables are case sensitive, this is a new variable.
age = 54 # This updates the age variable.
# Referencing variables
my_age = age # my_age is now set to 54
# Deleting variables
del(Age) # The age variable no longer exists. You will get an error if you try to use it.
# This is a dictionary, and you will use a lot of them...
cabinet = {
"Secretary of State": "William H. Seward",
"Secretary of the Treasury": "Salmon P. Chase",
"Secretary of War": "Edwin M. Stanton",
"Attorney General": "Edward Bates"
}
# Dictionaries can be deeply nested and contain any type of variable
cabinet = {
"Secretary of State": {
"name": "William H. Seward",
"age": 60,
"children": ['William Jr.', 'Frederick', 'Augustus', 'Anna']
}
}
# Readability
# The creator of Python Guido van Rossum, said
# “Code is read much more often than it’s written.” IT's important to
# create code that is easy to understand later on. For this reason
# We recommend following some standards
# (see https://realpython.com/python-pep8/ for more info.)
# *