class CustomPythonLab extends HTMLElement { connectedCallback() { this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = `

Python Editor

def find_first_prime(nums):
    """Return the first prime number in a list."""
    for num in nums:
        if num < 2:
            continue
        is_prime = True
        for i in range(2, int(num**0.5) + 1):
            if num % i == 0:
                is_prime = False
                break
        if is_prime:
            return num
    return None

# Test cases
print(find_first_prime([4, 6, 7, 8, 9, 10, 11])  # Should return 7
print(find_first_prime([1, 2, 3, 4, 5])  # Should return 2
print(find_first_prime([4, 6, 8, 10]))  # Should return None
            
Console Output
Click "Run Code" to see output...
Test Cases
First prime in [4, 6, 7, 8, 9, 10, 11]
PASS
First prime in [1, 2, 3, 4, 5]
PASS
Handles empty list
PASS
First prime in large list
FAIL
Returns None if no prime
PASS
`; setTimeout(() => { if (typeof feather !== 'undefined') { feather.replace(); } }, 100); } } customElements.define('custom-python-lab', CustomPythonLab);