Fall 2024 - P1
Big Idea 3 | .1 | .2 | .3 | .4 | .5 | .6 | .7 | .8 | .10 |
3.1 Variables and Strings
Team Teach String Operations
- Simple Popcorn Hack 🍿🍿🍿🍿 - Profile Creation
- JS Hack Code
- Make your own profile creation script with different, variable parameters!
____________________________________________________________________________________________________________________________________________
Simple Popcorn Hack 🍿🍿🍿🍿 - Profile Creation
var1 = input("What is your name?:")
var2 = input("What is your age?:")
var3 = input("What is your favorite Brawl Stars brawler?:")
my_list = [var1, var2, var3]
my_dict = {
var1,
var2,
var3
}
print(my_list)
print(my_dict)
print("Hi my name is " + var1 + ", I'm " + var2 + " years old" + ", and my favorite brawler is " + var3)
['Pradyun', '15', 'Darryl']
{'15', 'Darryl', 'Pradyun'}
Hi my name is Pradyun, I'm 15 years old, and my favorite brawler is Darryl
JS Hack Code
%%js
const var1 = prompt("What is your name?:");
const var2 = prompt("What is your age?:");
const var3 = prompt("What is your favorite Brawl Stars brawler?:");
const myList = [var1, var2, var3];
console.log(myList);
const myDict = {
name: var1,
age: var2,
favoriteFood: var3
};
console.log(myDict);
console.log("Hi, my name is " + var1 + ", I'm " + var2 + " years old, and my favorite brawler is " + var3 + ".");