Learn the fundamentals with real-life examples

Enhance your Python learning journey with real-world examples. Our examples demonstrate how to apply Python syntax and constructs to solve problems, giving you a head start on your programming projects. Plus, we'll showcase various approaches to tackling challenges, making it easier to become a proficient Python programmer
def method_one(entries: Sequence[int], threshold: int):
    result = []
    for entry in entries:
        if entry >= threshold:
            result.append(entry)
    return result


def method_two(entries: Sequence[int], threshold: int):
    for entry in entries:
        if entry >= threshold:
            yield entry


def method_three(entries: Sequence[int], threshold: int):
    return [entry for entry in entries if entry >= threshold]


def main():
    values = [1, 5, 293, 192, 391, 102, 203, 203]
    print(method_one(values, 100))
    print(list(method_two(values, 100)))
    print(method_three(values, 100))