kyu_5.alphabet_wars_nuclear_strike package

Submodules

kyu_5.alphabet_wars_nuclear_strike.alphabet_war module

Solution for -> Alphabet wars - nuclear strike.

Created by Egor Kostan. GitHub: https://github.com/ikostan

kyu_5.alphabet_wars_nuclear_strike.alphabet_war.alphabet_war(battlefield: str) str[source]

Alphabet war func.

A function that accepts battlefield string and returns letters that survived the nuclear strike. :param battlefield: :return: str

kyu_5.alphabet_wars_nuclear_strike.alphabet_war.clean_battlefield(battlefield: str) str[source]

Clean the battlefield and return only survived letters.

Parameters:

battlefield – str

Returns:

str

kyu_5.alphabet_wars_nuclear_strike.alphabet_war.clean_unsheltered(battlefield: str) str[source]

Clean letters outside the shelter.

Parameters:

battlefield – str

Returns:

str

kyu_5.alphabet_wars_nuclear_strike.test_alphabet_war module

Test for -> Alphabet wars - nuclear strike.

Created by Egor Kostan. GitHub: https://github.com/ikostan

class kyu_5.alphabet_wars_nuclear_strike.test_alphabet_war.AlphabetWarTestCase(methodName='runTest')[source]

Bases: TestCase

Testing alphabet_war function.

_classSetupFailed = False
_class_cleanups = []
test_alphabet_war = None
test_alphabet_war_00__a_b_c_(**kw)

Testing alphabet_war function [with battlefield=’[a]#[b]#[c]’, expected=’ac’].

Introduction There is a war and nobody knows - the alphabet war! The letters hide in their nuclear shelters. The nuclear strikes hit the battlefield and killed a lot of them.

Task Write a function that accepts battlefield string and returns letters that survived the nuclear strike.

  1. The battlefield string consists of only small letters, #,[ and ].

2. The nuclear shelter is represented by square brackets []. The letters inside the square brackets represent letters inside the shelter.

3. The # means a place where nuclear strike hit the battlefield. If there is at least one # on the battlefield, all letters outside of shelter die. When there is no any # on the battlefield, all letters survive (but do not expect such scenario too often ;-P ).

4. The shelters have some durability. When 2 or more # hit close to the shelter, the shelter is destroyed and all letters inside evaporate. The ‘close to the shelter’ means on the ground between the shelter and the next shelter (or beginning/end of battlefield). The below samples make it clear for you. :return:

test_alphabet_war_01__a_b_c_d_(**kw)

Testing alphabet_war function [with battlefield=’[a]#b#[c][d]’, expected=’d’].

Introduction There is a war and nobody knows - the alphabet war! The letters hide in their nuclear shelters. The nuclear strikes hit the battlefield and killed a lot of them.

Task Write a function that accepts battlefield string and returns letters that survived the nuclear strike.

  1. The battlefield string consists of only small letters, #,[ and ].

2. The nuclear shelter is represented by square brackets []. The letters inside the square brackets represent letters inside the shelter.

3. The # means a place where nuclear strike hit the battlefield. If there is at least one # on the battlefield, all letters outside of shelter die. When there is no any # on the battlefield, all letters survive (but do not expect such scenario too often ;-P ).

4. The shelters have some durability. When 2 or more # hit close to the shelter, the shelter is destroyed and all letters inside evaporate. The ‘close to the shelter’ means on the ground between the shelter and the next shelter (or beginning/end of battlefield). The below samples make it clear for you. :return:

test_alphabet_war_02__a_b_c_(**kw)

Testing alphabet_war function [with battlefield=’[a][b][c]’, expected=’abc’].

Introduction There is a war and nobody knows - the alphabet war! The letters hide in their nuclear shelters. The nuclear strikes hit the battlefield and killed a lot of them.

Task Write a function that accepts battlefield string and returns letters that survived the nuclear strike.

  1. The battlefield string consists of only small letters, #,[ and ].

2. The nuclear shelter is represented by square brackets []. The letters inside the square brackets represent letters inside the shelter.

3. The # means a place where nuclear strike hit the battlefield. If there is at least one # on the battlefield, all letters outside of shelter die. When there is no any # on the battlefield, all letters survive (but do not expect such scenario too often ;-P ).

4. The shelters have some durability. When 2 or more # hit close to the shelter, the shelter is destroyed and all letters inside evaporate. The ‘close to the shelter’ means on the ground between the shelter and the next shelter (or beginning/end of battlefield). The below samples make it clear for you. :return:

test_alphabet_war_03__a_a_b_c_(**kw)

Testing alphabet_war function [with battlefield=’##a[a]b[c]#’, expected=’c’].

Introduction There is a war and nobody knows - the alphabet war! The letters hide in their nuclear shelters. The nuclear strikes hit the battlefield and killed a lot of them.

Task Write a function that accepts battlefield string and returns letters that survived the nuclear strike.

  1. The battlefield string consists of only small letters, #,[ and ].

2. The nuclear shelter is represented by square brackets []. The letters inside the square brackets represent letters inside the shelter.

3. The # means a place where nuclear strike hit the battlefield. If there is at least one # on the battlefield, all letters outside of shelter die. When there is no any # on the battlefield, all letters survive (but do not expect such scenario too often ;-P ).

4. The shelters have some durability. When 2 or more # hit close to the shelter, the shelter is destroyed and all letters inside evaporate. The ‘close to the shelter’ means on the ground between the shelter and the next shelter (or beginning/end of battlefield). The below samples make it clear for you. :return:

test_alphabet_war_04_abde_fgh_ijk(**kw)

Testing alphabet_war function [with battlefield=’abde[fgh]ijk’, expected=’abdefghijk’].

Introduction There is a war and nobody knows - the alphabet war! The letters hide in their nuclear shelters. The nuclear strikes hit the battlefield and killed a lot of them.

Task Write a function that accepts battlefield string and returns letters that survived the nuclear strike.

  1. The battlefield string consists of only small letters, #,[ and ].

2. The nuclear shelter is represented by square brackets []. The letters inside the square brackets represent letters inside the shelter.

3. The # means a place where nuclear strike hit the battlefield. If there is at least one # on the battlefield, all letters outside of shelter die. When there is no any # on the battlefield, all letters survive (but do not expect such scenario too often ;-P ).

4. The shelters have some durability. When 2 or more # hit close to the shelter, the shelter is destroyed and all letters inside evaporate. The ‘close to the shelter’ means on the ground between the shelter and the next shelter (or beginning/end of battlefield). The below samples make it clear for you. :return:

test_alphabet_war_05_ab_de_fgh_ijk(**kw)

Testing alphabet_war function [with battlefield=’ab#de[fgh]ijk’, expected=’fgh’].

Introduction There is a war and nobody knows - the alphabet war! The letters hide in their nuclear shelters. The nuclear strikes hit the battlefield and killed a lot of them.

Task Write a function that accepts battlefield string and returns letters that survived the nuclear strike.

  1. The battlefield string consists of only small letters, #,[ and ].

2. The nuclear shelter is represented by square brackets []. The letters inside the square brackets represent letters inside the shelter.

3. The # means a place where nuclear strike hit the battlefield. If there is at least one # on the battlefield, all letters outside of shelter die. When there is no any # on the battlefield, all letters survive (but do not expect such scenario too often ;-P ).

4. The shelters have some durability. When 2 or more # hit close to the shelter, the shelter is destroyed and all letters inside evaporate. The ‘close to the shelter’ means on the ground between the shelter and the next shelter (or beginning/end of battlefield). The below samples make it clear for you. :return:

test_alphabet_war_06_ab_de_fgh_ij_k(**kw)

Testing alphabet_war function [with battlefield=’ab#de[fgh]ij#k’, expected=’’].

Introduction There is a war and nobody knows - the alphabet war! The letters hide in their nuclear shelters. The nuclear strikes hit the battlefield and killed a lot of them.

Task Write a function that accepts battlefield string and returns letters that survived the nuclear strike.

  1. The battlefield string consists of only small letters, #,[ and ].

2. The nuclear shelter is represented by square brackets []. The letters inside the square brackets represent letters inside the shelter.

3. The # means a place where nuclear strike hit the battlefield. If there is at least one # on the battlefield, all letters outside of shelter die. When there is no any # on the battlefield, all letters survive (but do not expect such scenario too often ;-P ).

4. The shelters have some durability. When 2 or more # hit close to the shelter, the shelter is destroyed and all letters inside evaporate. The ‘close to the shelter’ means on the ground between the shelter and the next shelter (or beginning/end of battlefield). The below samples make it clear for you. :return:

test_alphabet_war_07__abde_fgh_ijk(**kw)

Testing alphabet_war function [with battlefield=’##abde[fgh]ijk’, expected=’’].

Introduction There is a war and nobody knows - the alphabet war! The letters hide in their nuclear shelters. The nuclear strikes hit the battlefield and killed a lot of them.

Task Write a function that accepts battlefield string and returns letters that survived the nuclear strike.

  1. The battlefield string consists of only small letters, #,[ and ].

2. The nuclear shelter is represented by square brackets []. The letters inside the square brackets represent letters inside the shelter.

3. The # means a place where nuclear strike hit the battlefield. If there is at least one # on the battlefield, all letters outside of shelter die. When there is no any # on the battlefield, all letters survive (but do not expect such scenario too often ;-P ).

4. The shelters have some durability. When 2 or more # hit close to the shelter, the shelter is destroyed and all letters inside evaporate. The ‘close to the shelter’ means on the ground between the shelter and the next shelter (or beginning/end of battlefield). The below samples make it clear for you. :return:

test_alphabet_war_08__abde_fgh_(**kw)

Testing alphabet_war function [with battlefield=’##abde[fgh]’, expected=’’].

Introduction There is a war and nobody knows - the alphabet war! The letters hide in their nuclear shelters. The nuclear strikes hit the battlefield and killed a lot of them.

Task Write a function that accepts battlefield string and returns letters that survived the nuclear strike.

  1. The battlefield string consists of only small letters, #,[ and ].

2. The nuclear shelter is represented by square brackets []. The letters inside the square brackets represent letters inside the shelter.

3. The # means a place where nuclear strike hit the battlefield. If there is at least one # on the battlefield, all letters outside of shelter die. When there is no any # on the battlefield, all letters survive (but do not expect such scenario too often ;-P ).

4. The shelters have some durability. When 2 or more # hit close to the shelter, the shelter is destroyed and all letters inside evaporate. The ‘close to the shelter’ means on the ground between the shelter and the next shelter (or beginning/end of battlefield). The below samples make it clear for you. :return:

test_alphabet_war_09__abcde_fgh_(**kw)

Testing alphabet_war function [with battlefield=’##abcde[fgh]’, expected=’’].

Introduction There is a war and nobody knows - the alphabet war! The letters hide in their nuclear shelters. The nuclear strikes hit the battlefield and killed a lot of them.

Task Write a function that accepts battlefield string and returns letters that survived the nuclear strike.

  1. The battlefield string consists of only small letters, #,[ and ].

2. The nuclear shelter is represented by square brackets []. The letters inside the square brackets represent letters inside the shelter.

3. The # means a place where nuclear strike hit the battlefield. If there is at least one # on the battlefield, all letters outside of shelter die. When there is no any # on the battlefield, all letters survive (but do not expect such scenario too often ;-P ).

4. The shelters have some durability. When 2 or more # hit close to the shelter, the shelter is destroyed and all letters inside evaporate. The ‘close to the shelter’ means on the ground between the shelter and the next shelter (or beginning/end of battlefield). The below samples make it clear for you. :return:

test_alphabet_war_10_abcde_fgh_(**kw)

Testing alphabet_war function [with battlefield=’abcde[fgh]’, expected=’abcdefgh’].

Introduction There is a war and nobody knows - the alphabet war! The letters hide in their nuclear shelters. The nuclear strikes hit the battlefield and killed a lot of them.

Task Write a function that accepts battlefield string and returns letters that survived the nuclear strike.

  1. The battlefield string consists of only small letters, #,[ and ].

2. The nuclear shelter is represented by square brackets []. The letters inside the square brackets represent letters inside the shelter.

3. The # means a place where nuclear strike hit the battlefield. If there is at least one # on the battlefield, all letters outside of shelter die. When there is no any # on the battlefield, all letters survive (but do not expect such scenario too often ;-P ).

4. The shelters have some durability. When 2 or more # hit close to the shelter, the shelter is destroyed and all letters inside evaporate. The ‘close to the shelter’ means on the ground between the shelter and the next shelter (or beginning/end of battlefield). The below samples make it clear for you. :return:

test_alphabet_war_11__abde_fgh_ijk_mn_op(**kw)

Testing alphabet_war function [with battlefield=’##abde[fgh]ijk[mn]op’, expected=’mn’].

Introduction There is a war and nobody knows - the alphabet war! The letters hide in their nuclear shelters. The nuclear strikes hit the battlefield and killed a lot of them.

Task Write a function that accepts battlefield string and returns letters that survived the nuclear strike.

  1. The battlefield string consists of only small letters, #,[ and ].

2. The nuclear shelter is represented by square brackets []. The letters inside the square brackets represent letters inside the shelter.

3. The # means a place where nuclear strike hit the battlefield. If there is at least one # on the battlefield, all letters outside of shelter die. When there is no any # on the battlefield, all letters survive (but do not expect such scenario too often ;-P ).

4. The shelters have some durability. When 2 or more # hit close to the shelter, the shelter is destroyed and all letters inside evaporate. The ‘close to the shelter’ means on the ground between the shelter and the next shelter (or beginning/end of battlefield). The below samples make it clear for you. :return:

test_alphabet_war_12__abde_fgh_i_jk_mn_op(**kw)

Testing alphabet_war function [with battlefield=’#abde[fgh]i#jk[mn]op’, expected=’mn’].

Introduction There is a war and nobody knows - the alphabet war! The letters hide in their nuclear shelters. The nuclear strikes hit the battlefield and killed a lot of them.

Task Write a function that accepts battlefield string and returns letters that survived the nuclear strike.

  1. The battlefield string consists of only small letters, #,[ and ].

2. The nuclear shelter is represented by square brackets []. The letters inside the square brackets represent letters inside the shelter.

3. The # means a place where nuclear strike hit the battlefield. If there is at least one # on the battlefield, all letters outside of shelter die. When there is no any # on the battlefield, all letters survive (but do not expect such scenario too often ;-P ).

4. The shelters have some durability. When 2 or more # hit close to the shelter, the shelter is destroyed and all letters inside evaporate. The ‘close to the shelter’ means on the ground between the shelter and the next shelter (or beginning/end of battlefield). The below samples make it clear for you. :return:

test_alphabet_war_13__ab_adfd_dd_abe_dedf_ijk_d_d_h_(**kw)

Testing alphabet_war function [with battlefield=’[ab]adfd[dd]##[abe]dedf[ijk]d#d[h]#’, expected=’abijk’].

Introduction There is a war and nobody knows - the alphabet war! The letters hide in their nuclear shelters. The nuclear strikes hit the battlefield and killed a lot of them.

Task Write a function that accepts battlefield string and returns letters that survived the nuclear strike.

  1. The battlefield string consists of only small letters, #,[ and ].

2. The nuclear shelter is represented by square brackets []. The letters inside the square brackets represent letters inside the shelter.

3. The # means a place where nuclear strike hit the battlefield. If there is at least one # on the battlefield, all letters outside of shelter die. When there is no any # on the battlefield, all letters survive (but do not expect such scenario too often ;-P ).

4. The shelters have some durability. When 2 or more # hit close to the shelter, the shelter is destroyed and all letters inside evaporate. The ‘close to the shelter’ means on the ground between the shelter and the next shelter (or beginning/end of battlefield). The below samples make it clear for you. :return:

Module contents

Alphabet wars - nuclear strike package.