Popcorn Hack 1

Try making your own list then apend an element

# Create a list
my_list = ['apple', 'banana', 'cherry']

# Add an element to the list
my_list.append('orange')

# Delete a different element (for example: 'banana')
my_list.remove('banana')

# Print the updated list
print("Updated List:", my_list)
Updated List: ['apple', 'cherry', 'orange']

Popcorn Hack 2

Try adding an element Try deleting a different element

# Create a list
my_list = ['grape', 'watermelon', 'pear']

# Add a new element to the list
my_list.append('mango')

# Delete a different element (for example: 'watermelon')
my_list.remove('watermelon')

# Print the updated list
print("Updated List:", my_list)
Updated List: ['grape', 'pear', 'mango']

Popcorn Hack 3

Try changing one of your elements into something new

# Create a list
my_list = ['grape', 'watermelon', 'pear']

# Change the second element ('watermelon') to something new ('apple')
my_list[1] = 'apple'

# Print the updated list
print("Updated List:", my_list)
Updated List: ['grape', 'apple', 'pear']

Popcorn Hack 4

Find the minimum value in a list

Create or access the list. Make a variable to hold the minimum and set it to a potential minimum value. Loop through the list. Check each element to see if it is less than the minimum variable. If the element is less than the minimum variable, update the minimum. After all elements of the list have been checked, display the minimum value.

# Create a list
my_list = [23, 1, 45, 78, -5, 34, 2]

minimum_value = my_list[0]

# Loop through the list starting from the second element
for num in my_list[1:]:
    # If the current number is less than the minimum, update the minimum
    if num < minimum_value:
        minimum_value = num

# Display the minimum value
print("The minimum value in the list is:", minimum_value)
The minimum value in the list is: -5