3.1 Hacks | 3.2 Hacks | 3.3 Hacks | 3.4 Hacks | 3.5 Hacks | 3.8 Hacks | 3.10a Hacks | 3.10b Hacks | Sprint 2 Personal Learnings Blog | Sprint 2 Team Blog |
3.1 Hacks
Python and Javascript Popcorn and Homework Hacks for 3.1
Python Popcorn and Homework Hacks
#Popcorn Hack 1
player_one = "Risha"
player_two = "Vibha"
player_three = "Ava"
print("CSP Group is: " + player_one + " " + player_two + " and " + player_three)
CSP Group is: Risha Vibha and Ava
#Popcorn Hack 2
fruits = {
"apple": "red",
"orange": "orange",
"banana": "yellow",
"blueberry": "blue"
}
print ("A blueberry is " + fruits["blueberry"] )
A blueberry is blue
Javascript Popcorn and Homework Hacks
%%javascript
/* Popcorn Hack 1 */
let array = [
"this is a string",
94,
true,
[3, 6, 9]
]
console.log("Mixed Array: ", mixedArray)
<IPython.core.display.Javascript object>
%%javascript
/* Homework Hack 1 */
let Class = "CSP";
let period = 4;
let isStudent = true;
const schoolName = "Del Norte High School";
console.log("Class taken: " + Class);
console.log("Period: " + period);
console.log("Is Student: " + isStudent);
console.log("School Name: " + schoolName);
function introduceClass() {
let introduction = `The class I am taking is ${Class}, I am in Period ${period} and this class is being taken at ${schoolName}. Am I a student? ${isStudent}.`;
console.log(introduction);
}
introduceClass();
<IPython.core.display.Javascript object>
%%javascript
/* Homework Hack 2 */
let score1Math = 85;
let score1English = 90;
let score1Science = 85;
average = (score1Math + score1English + score1Science) / 3
let student = [
{
name: "Student 1",
age: 16,
averageGrade: student1Average
},
];
console.log("Student Information:");
console.log(`Name: ${student.name}, Age: ${student.age}, Average Grade: ${student.averageGrade}`);
<IPython.core.display.Javascript object>