Skip to the content.

3.10 Hacks

Tri 1 Team Teach Hacks

Popcorn Hack 1

list = ['Brawl Stars', 'Fortnite', 'Among Us']
list.append('Roblox')
print(list)

Popcorn Hack 2

list = ['Brussels Sprouts','Broccoli','Cabbage']
del list[1]
list.append('Cucumber')
print(list)

Popcorn Hack 3

list = ['Math','Science','History']
list[0] = 'English'
print(list)

Homework Hack

import random
list = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
even_sum = 0
num = random.choice(list)
print("Randomly selected number: ", num)
for num in list:
    if num % 2 == 0:
        even_sum += num
print("The sum of the even numbers in the list is: ", even_sum)
min_value = min(list)
max_value = max(list)
print("The minimum value in the list is: ", min_value)
print("The maximum value in the list is: ", max_value)