Class 5 Reflection


In Class 5, we went deper into algorithms. Here, we learned how to develop algorithms. The purpose of developing algorithms is so that we can automate and simplify repetitive code. In this clas, I think algorithms were explained in a more simple way and it was much easier to understand. We learned that there was more than one way to code an algorithm and still get the same result. They also taught us that algorithms can be used to compute math. They also taught us a way to sort lists using selection sort and insertion sort.

Homework 1:

# Example algorithm of loop

# Initialize a counter to keep track of the count of odd numbers
count = 0
# Loop through numbers from 1 to 10
for number in range(1, 11):  
 # Check if the number is odd
 if number % 2 != 0: 
        # Increment the count if the number is odd
        count += 1  

print("Count of odd numbers from 1 to 10:", count)

Homework 2:

## Insert your code here:

shoot = ["Classic", "Shorty", "Frenzy", "Ghost", "Sheriff", "Stinger", "Spectre", "Bulldog", "Guardian", "Phantom", "Vandal", "Marshal", "Operator", "Ares", "Odin"]

totalWeapons = 0

for weapon in shoot:
    totalWeapons += 1

print("Number of weapons in Valorant: ", totalWeapons)