AI is all about data, and data rarely comes as a single number. It comes in collections.
In Python, the most common way to store a collection of items is a List.
A list is created using square brackets []. You can store numbers, strings, or even other lists inside.
You can access items in a list using their index. Remember, Python is "zero-indexed", meaning the first item is at index 0.
To do something with every item in a list, we use a for loop. This is crucial for iterating through datasets or simulating training steps!
If you want to loop a specific number of times, you can use the range() function:
Let's simulate evaluating a model. You have a list of prediction scores between 0 and 1. We want to count how many predictions are above our threshold.
scores = [0.9, 0.3, 0.7, 0.85, 0.2, 0.95].high_confidence_count and set it to 0.for loop to go through each score in scores.if statement to check if the score is greater than 0.8. If it is, add 1 to your count.print() the final count.