본문 바로가기

Python_Matter/Solve

Python Learn the basics Quiz 98

반응형

Q>

A pangram (Greek:παν γράμμα, pan gramma, "every letter") or holoalphabetic sentence for a given alphabet is a sentence using every letter of the alphabet at least once.

(주어진 알파벳에 대한 팡그람 (그리스어 : πανγράμμα, 팬 그램, "모든 문자") 또는 홀로 알파벳 문자는 적어도 한 번 알파벳의 모든 문자를 사용하는 문장입니다.)

Perhaps you are familiar with the well known pangram "The quick brown fox jumps over the lazy dog".

(아마 당신은 유명한 pangram에 익숙합니다. "빠른 여우는 게으른 개를 뛰어 넘습니다.")

For this mission, we will use the latin alphabet (A-Z).

(이 임무를 위해 우리는 라틴 알파벳 (A-Z)을 사용할 것입니다.)

You are given a text with latin letters and punctuation symbols.

(라틴 문자와 구두점 기호가있는 텍스트가 제공됩니다.)

You need to check if the sentence is a pangram or not. Case does not matter.

(문장이 문장인지 아닌지 확인해야합니다. 사건은 중요하지 않습니다.)

 

Input: A text as a string.

        (문자열을 텍스트로 나타냅니다.)

 

Output: Whether the sentence is a pangram or not as a boolean.

           (문장이 부울로 간주되는지 여부)

 

Example:

check_pangram("The quick brown fox jumps over the lazy dog.") == True
check_pangram("ABCDEF.") == False

 

How it is used: Pangrams have been used to display typefaces, test equipment, and develop skills in handwriting,

                     (Pangram은 서체를 표시하고, 장비를 시험하고, 필기 기술을 개발하는 데 사용되어 왔습니다.)

                     calligraphy, and keyboarding for ages.

                     (서예, 키 보딩)

 

Precondition:

all(ch in (string.punctuation + string.ascii_letters + " ") for ch in text)
0 < len(text)

 

A>

# string : 문자열 연산 모듈
import string

def check_pangram(text):
    '''
        is the given text is a pangram.
    '''
    # your code here
    # string.ascii_lowercase : 소문자 'abcdefghijklmnopqrstuvwxyz' 를 상수로 정의
    return not set(string.ascii_lowercase) - set(text.lower())

if __name__ == '__main__':
    # These "asserts" using only for self-checking and not necessary for auto-testing
    assert check_pangram("The quick brown fox jumps over the lazy dog."), "brown fox"
    assert not check_pangram("ABCDEF"), "ABC"
    assert check_pangram("Bored? Craving a pub quiz fix? Why, just come to the Royal Oak!"), "Bored?"
    print('If it is done - it is Done. Go Check is NOW!')

 

O>

If it is done - it is Done. Go Check is NOW!

Process finished with exit code 0

 

S>

https://py.checkio.org/

반응형

'Python_Matter > Solve' 카테고리의 다른 글

Python Learn the basics Quiz 100  (0) 2019.06.25
Python Learn the basics Quiz 99  (0) 2019.06.25
Python Learn the basics Quiz 97  (0) 2019.06.24
Python Learn the basics Quiz 96  (0) 2019.06.24
Python Learn the basics Quiz 95  (0) 2019.06.24