Home API Notes
print("What is the variable name/key?", "value?", "type?", "primitive or collection, why?")
name = "Ethan Tran"
print("name", name, type(name))

print()


# variable of type integer
print("What is the variable name/key?", "value?", "type?", "primitive or collection, why?")
age = 15
print("age", age, type(age))

print()

# variable of type float
print("What is the variable name/key?", "value?", "type?", "primitive or collection, why?")
score = 100.0
print("score", score, type(score))

print()

# variable of type list (many values in one variable)
print("What is variable name/key?", "value?", "type?", "primitive or collection?")
print("What is different about the list output?")
langs = ["Python", "JavaScript", "Java" , "Bash" , "C" , "R"] 
print("langs", langs, type(langs), "length", len(langs))
print("- langs[0]", langs[0], type(langs[0]))

print()

# variable of type dictionary (a group of keys and values)
print("What is the variable name/key?", "value?", "type?", "primitive or collection, why?")
print("What is different about the dictionary output?")
person = {
    "name": name,
    "age": age,
    "score": score,
    "langs": langs,
}
print("person", person, type(person), "length", len(person))
print('- person["name"]', person["name"], type(person["name"]))
What is the variable name/key? value? type? primitive or collection, why?
name Ethan Tran <class 'str'>

What is the variable name/key? value? type? primitive or collection, why?
age 15 <class 'int'>

What is the variable name/key? value? type? primitive or collection, why?
score 100.0 <class 'float'>

What is variable name/key? value? type? primitive or collection?
What is different about the list output?
langs ['Python', 'JavaScript', 'Java', 'Bash', 'C', 'R'] <class 'list'> length 6
- langs[0] Python <class 'str'>

What is the variable name/key? value? type? primitive or collection, why?
What is different about the dictionary output?
person {'name': 'Ethan Tran', 'age': 15, 'score': 100.0, 'langs': ['Python', 'JavaScript', 'Java', 'Bash', 'C', 'R']} <class 'dict'> length 4
- person["name"] Ethan Tran <class 'str'>
Color = "Red" ; "Blue" ; "Green" ; "Yellow" ; "Purple"
name = "Ethan" ; "John" ; "Jane"
age = "15" ; "17" ; "20"
print("/" , Color)
print("//" , name)
print("///" , age)
Person = {
    "Color": Color,
    "name": name,
    "age": age
}
print(Person)
/ Red
// Ethan
/// 15
{'Color': 'Red', 'name': 'Ethan', 'age': '15'}