Classes and files

4. Katas

Problem:

  • We have a string in lower case, you need to get two lines one with the other's vowels with consonants, which will be written to the files. All this must be done with the help of one class and called in this form:

    print(VowelsClass('some string'))
    where VowelsClass - class name

Task:

  • As you understand with the title, your task will be to write a class. Which will convert the string to a string with vowels and separately with consonants, and write them to files. Also With a Print Class, as shown in the Problem above, it should issue the following text:

    String: 'string'
    Without vowels 'strng'; Write to file --> 'with_vowels.txt'
    Without consonants 'i'; Write to file --> 'without_vowels.txt'

Data to verify:

VowelsClass() - class name
  • VowelsClass('some word in on string') -->

    String: 'some word in on string'
    Without vowels 'sm wrd in n strng'; Write to file --> 'with_vowels.txt'
    Without consonants 'oe o i o i'; Write to file --> 'without_vowels.txt'
  • VowelsClass('one, two, three, four, five, six, ...') -->

    String: 'one, two, three, four, five, six, ...'
    Without vowels 'on, tw, thr, fr, fv, sx, ...'; Write to file --> 'with_vowels.txt'
    Without consonants 'e, o, ee, ou, ie, i, ...'; Write to file --> 'without_vowels.txt'
  • VowelsClass('I'm an independent string') -->

    String: 'I'm an independent string'
    Without vowels ''m n ndpndnt strng'; Write to file --> 'with_vowels.txt'
    Without consonants 'I' a ieee i'; Write to file --> 'without_vowels.txt'
Where "-->" means after starting the program

What's next ?

The program does not come out or works not exactly,go to the solution folder and look at the explanation for solving the problem, this will help you.

If you have everything turned out, you can go to the solution package and compare your solution with the one that's there.

If your decision does not coincide with my decision, then I'm very happy for you. Please share it with me, I will be very grateful to you and then I will add it to the solution folder. How to add your solution, see here

See Solution or visit Github page: