Check if a string is a pangram in Python

This Python function checks if a string is a pangram, which is a word or sentence containing every letter of the alphabet at least once.

Problem

Given a string, write a Python function to check if the string is a pangram or not.
Pangrams are words or sentences containing every letter of the alphabet at least once.
Example input: "The quick brown fox jumps over the lazy dog"
Example output: True

Solution

This solution is in Python. Our A.I. can create solutions in multiple languages.
by kayakane
# Solution:

def is_pangram(sentence):
    alphabet = "abcdefghijklmnopqrstuvwxyz"
    for letter in alphabet:
        if letter not in sentence.lower():
            return False
    return True

# Explanation:

# The solution above is optimal because it uses a single loop to check if every letter of the alphabet is in the sentence.
# The alphabet string is created outside of the loop to avoid creating it every time the loop runs.
# The loop checks if each letter is in the sentence, and if it is not, it returns False.
# If the loop finishes without returning False, it returns True.

A.I. Evaluation of the Solution

The candidate's solution is correct and demonstrates a level of completeness. The candidate's approach is also efficient, using a single loop to check if every letter of the alphabet is in the sentence.

Evaluated at: 2022-11-22 14:16:06