Skip to the content.

Big Idea 3 Unit 1

Big Idea 3 Unit 1

Summary

This lesson is about variables, naming conventions, and data types in both python and javascript. Some common data types are strings, integers, floats, booleans, arrays, objects, and lists.

  • Strings: words in quotation marks
  • Integers: Numbers without decimals
  • Floats: Numbers with decimals
  • Booleans: True/False Values
  • Arrays: Fixed collections of elements
  • Object: Similar to array but has key-value pairs Scroll to find homework and examples!
# Python examples
# Popcorn Hack 1
subject = "Math" # String Variable
birthday = "August 38th" # String Variable
favoriteNumber = 7 # Integer Variable

# Popcorn Hack 2
cold = False
busy = True 
print(cold) # Prints False
print(busy) # Prints True

# Popcorn Hack 3
my_stuff = {
    'name': "Soumini",
    'age': 14,
    'subjects': ['Math', 'Chemistry', 'CSP', 'English', 'History'],
}
print(my_stuff) # Prints {'name': 'Soumini', 'age': 14, 'subjects': ['Math', 'Chemistry', 'CSP', 'English', 'History']}

# Homework
name = "Soumini" # String Variable
age = 14 # Integer Variable
favorite_number = 7.0 # Float Variable

favorite_food = "none" # snake_case
FavoriteHobby = "reading" # PascalCase
favoriteColor = "all colors but mostly purple" # camelCase

myList = [name, age, favorite_number] # A list

me = {
    'name': name, # key for name
    'age' : age, # key for age
    'favorite_number': favorite_number, # key for favorite number
}
// Javascript examples: 
//Popcorn Hack 1
let fav_subject = "math";
let hobby = "reading";
let number = 7;

// Popcorn Hack 2
var event = {
    date: "September 36th",
    time: "4 pm",
    thing: "Birthday Party",
    location: "Saturn the Planet",
    participants: 30,
};
console.log(event)

// Popcorn Hack 3
let first = 61409;
let second = 90709;
let one = "I don't like ";
let two = "bell peppers";
console.log(first + second)
console.log(one + two)

// Homework
let name = "Soumini"
let age = 14
let favorite_number = 7.0

let favorite_food = "none"
let FavoriteHobby = "reading"
let favoriteColor = "all colors but mostly purple"

let myList = ['Soumini', 14, 7]

let me = {
    'name': 'Soumini',
    'age': age,
    'favorite_number': favorite_number
};