Загрузка...

Кто решит задачу?

Тема в разделе Python создана пользователем daniil12qoeu 15 ноя 2020. 268 просмотров

  1. daniil12qoeu
    daniil12qoeu Автор темы 15 ноя 2020 Заблокирован(а) 135 29 май 2018
    В английском языке есть как минимум одно слово, которое содержит все гласные (a, e, i, o, u, y) в таком алфавитном порядке. Напишите программу, которая находит файл со списком слов и выводит на экран все слова которые соответствуют этим условиям. Пользователь введёт имя файла. Выведите на экран ошибку и закончите программу, если пользователь введёт неверное имя файла или что то пойдёт не так

    Вот слова:
    abstemious
    abstemiously
    acheilous
    acheirous
    avenious
    caesious
    placentious
    the
    free
    dictionary
    entries
    with
    English
    transtendinous
    definitions
    from
    over
    languages
    Browse
    All
    languages
    List
    of
    topics
    Random
    word
    New
    entries
    Appendices
    Abbreviations
    Thesaurus
    Rhymes
    Frequency
    lists
    Phrasebooks
    Welcome
    to
    the
    abstemiously
    English
    acedious
    language
    Wiktionary,
    a
    collaborative
    project
    to
    produce
    adecticous
    a
    abstenious
    free-content
    fracedinous
    multilingual
    dictionary.
    It
    aims
    to
    describe
    all
    words
    facetious
    of
    all
    languages
    using
    definitions
    and
    descriptions
    in
    English.
    Wiktionary
    has
    grown
    beyond
    a
    standard
    facetiously
    dictionary
    and
    now
    includes
    a
    thesaurus
    rhyme
    guide
    phrase
    arsenious
    books
    language
    tragedious
    statistics
    and
    extensive
    appendices
    materious
    We
    aim
    to
    include
    not
    only
    the
    definition
    abstentious
    of
    acerbitous
    a
    word
    but
    also
    enough
    information
    to
    really
    understand
    it
    Thus
    etymologies
    pronunciations
    sample
    quotations
    synonyms
    antonyms
    and
    translations
    are
    included
    Wiktionary
    larcenious
    is
    a
    wiki
    which
    means
    that
    you
    aerious
    affectious
    anemious
    annelidous
    anteriour
    anteriourly
    can
    edit
    it
    and
    all
    the
    content
    is
    dual
    licensed
    under
    both
    the
    Creative
    Commons
    Attribution
    ShareAlike
    Unported
    License
    and
    the
    GNU
    Free
    Documentation
    License.
    Before
    travertinous
    you
    contribute,
    you
    may
    wish
    to
    read
    through
    some
    of
    our
    help
    pages,
    and
    bear
    in
    mind
    that
    we
    do
    things
    quite
    differently
    from
    other
    wikis.
    In
    particular,
    we
    have
    strict
    layout
    conventions
    and
    inclusion
    criteria.
    Learn
    how
    to
    start
    a
    page,
    how
    to
    edit
    entries,
    experiment
    in
    the
    sandbox
    and
    visit
    our
    Community
    Portal
    to
    see
    how
    you
    can
    participate
    in
    the
    development
    of
    Wiktionary.
     
  2. Humboy13
    Humboy13 15 ноя 2020 41 8 янв 2020
    Python
    import re


    pattern = r"a\w*e\w*i\w*o\w*u\w*y"
    try:
    with open("filename.txt", "r") as file:
    for words in file.readlines():
    match = re.search(pattern, words)
    if match:
    print(words)
    except Exception:
    print("Что-то пошло не так, может вы где-то ошиблись")
     
    1. Handler
      Humboy13, в папке из которой запускается скрипт должен лежать файл
      filename.txt со словами.

      Если кому не понятен код.
Top
Загрузка...