3.1.1 Popcorn Hacks

smartest_team_member = "risha guha "
asks_most_questions = "ava shalom "
other_person = "vibha mandayam"

print(smartest_team_member + asks_most_questions + other_person)
risha guha ava shalom vibha mandayam

3.1.2 Popcorn Hacks

fruits_dict = {'apple': 'red', 'orange': 'orange', 'banana': 'yellow', 'watermelon': 'green'}
print(fruits_dict)

{'apple': 'red', 'orange': 'orange', 'banana': 'yellow', 'watermelon': 'green'}

3.1.4 Popcorn Hacks

let mixedArray = [
    "Hello, world!",       
    42,                    
    true,                  
    { name: "Alice", age: 30 },  
    [1, 2, 3],            
    null                   
];

console.log("Mixed Array:", mixedArray);

3.1.3 Homework Hacks

const petType = "dog";          
let petName = "Buddy";          
let numberOfPets = 3;           

console.log(`Pet Type: ${petType}`);
console.log(`Pet Name: ${petName}`);
console.log(`Number of Pets: ${numberOfPets}`);

function createPetMessage() {
    return `I have ${numberOfPets} ${petType}(s) named ${petName}.`;
}

console.log(createPetMessage());

3.1.4 Homework Hacks

function calculateAverageGrade(scores) {
    let total = 0;
    for (let score of scores) {
        total += score; 
    }
    return total / scores.length; 
}

let student1Scores = [85, 90, 78, 92]; 
let student2Scores = [88, 76, 95, 89];

let student1Average = calculateAverageGrade(student1Scores); // Calculate average for student 1
let student2Average = calculateAverageGrade(student2Scores); // Calculate average for student 2

let studentsInfo = [
    { name: "Alice", age: 20, averageGrade: student1Average }, // Student 1 info
    { name: "Bob", age: 22, averageGrade: student2Average }    // Student 2 info
];

console.log("Average Grades:");
console.log(`${studentsInfo[0].name} (Age: ${studentsInfo[0].age}): Average Grade: ${studentsInfo[0].averageGrade.toFixed(2)}`);
console.log(`${studentsInfo[1].name} (Age: ${studentsInfo[1].age}): Average Grade: ${studentsInfo[1].averageGrade.toFixed(2)}`);