Skip to the content.

3.1 HW

3.1 HW and Popcorn Hacks

Tri 1 Documentation

#Popcorn Hack 1
MemberOne = "Anvay Vahia"
MemberTwo = "Rayhaan Sheeraj"
MemberThree = "Kiruthic Selvakumar"
MemberFour = "Pranav Santhosh"
MemberFive = "Yuva Bala"

print("Members of Popcorn Hack 1 are: ", MemberOne, MemberTwo, MemberThree, MemberFour, MemberFive)
Members of Popcorn Hack 1 are:  Anvay Vahia Rayhaan Sheeraj Kiruthic Selvakumar Pranav Santhosh Yuva Bala
#Popcorn Hack 2
fruits = {
    "apple": {
        "color": "red",
        
    },
    "banana": {
        "color": "yellow",

    },
    "cherry": {
        "color": "red",
    },
    "orange": {
        "color": "orange",
        "taste": "citrus",

    }
}
print("Here are some fruits with descriptions,", fruits)

Here are some fruits with descriptions, {'apple': {'color': 'red'}, 'banana': {'color': 'yellow'}, 'cherry': {'color': 'red'}, 'orange': {'color': 'orange', 'taste': 'citrus'}}
// Popcorn Hack 3
const fruit = {
    name: "Banana"  
    color = "Green"
}

console.log("Unripe Bananan is", fruit.color); 
fruit.color = "Yellow";
console.log("Ripe Banana is", fruit.color);

// Popcorn Hack #4
const Array = ["Hello, World!", 3.14];
// Homework Hack #1
const fruitName = "Apple";

// Define a variable for the fruit color
let fruitColor = "Red";

// Define a variable for the fruit taste
let fruitTaste = "Sweet";

// Values of the variables to the console
console.log("Fruit Name:", fruitName);
console.log("Fruit Color:", fruitColor);
console.log("Fruit Taste:", fruitTaste);

// Function to create a sentence from the fruit descriptions
function describeFruit(name, color, taste) {
    return `The ${name} is ${color} and tastes ${taste}.`;
}


console.log(describeFruit(fruitName, fruitColor, fruitTaste));

# Homework Hack 2

# Define the scores as variables
score1 = 95
score2 = 90
score3 = 98
score4 = 92
score5 = 88
score6 = 100
score7 = 94

# Calculate the total score 
total_score = score1 + score2 + score3 + score4 + score5 + score6 + score7

# Calculate the number of scores
number_of_scores = 7

# Calculate the average grade
average_grade = total_score / number_of_scores

# Define student name and age
student_name = "Rayhaan Sheeraj"
student_age = 15

# Create a list containing student information
student_info = [student_name, student_age, average_grade]

# Print the scores
print("Scores:", score1, score2, score3, score4, score5, score6, score7)

# Print the total score
print("Total Score:", total_score)

# Print the average grade
print("Average Grade:", average_grade)

# Print the student information list
print("Student Info:", student_info)

Scores: 95 90 98 92 88 100 94
Total Score: 657
Average Grade: 93.85714285714286
Student Info: ['Rayhaan Sheeraj', 15, 93.85714285714286]