diff --git a/StateCap.py b/StateCap.py index 73fcf7f..2e6b3e4 100644 --- a/StateCap.py +++ b/StateCap.py @@ -65,29 +65,36 @@ 'Washington' : 'Olympia', 'West Virginia' : 'Charleston', 'Wisconsin' : 'Madison', - 'Wyoming' : 'Cheyenne', + 'Wyoming' : 'Cheyenne' + 'Test' : 'Montgomery', } def capital_of_Idaho(): - # Your code here + print(STATES_CAPITALS["Idaho"]) pass def all_states(): - # Your code here + print(STATES_CAPITALS.keys()) pass def all_capitals(): - # Your code here + print(STATES_CAPITALS.values()) pass def states_capitals_string(): - # Your code here + print(" -> ".join(sorted(STATES_CAPITALS))) pass def get_state(capital): + capitals_states = {} + + for state, capital in STATES_CAPITALS.items(): + capitals_states.setdefault(capital, []) + capitals_states[capital].append(state) + print(capitals_states) pass diff --git a/String_four_char.PNG b/String_four_char.PNG new file mode 100644 index 0000000..fc95212 Binary files /dev/null and b/String_four_char.PNG differ diff --git a/all_capitals.PNG b/all_capitals.PNG new file mode 100644 index 0000000..b204906 Binary files /dev/null and b/all_capitals.PNG differ diff --git a/capital_of_idaho.PNG b/capital_of_idaho.PNG new file mode 100644 index 0000000..bbba20c Binary files /dev/null and b/capital_of_idaho.PNG differ diff --git a/get_states.PNG b/get_states.PNG new file mode 100644 index 0000000..1f59373 Binary files /dev/null and b/get_states.PNG differ diff --git a/no_duplicate.PNG b/no_duplicate.PNG new file mode 100644 index 0000000..c23f607 Binary files /dev/null and b/no_duplicate.PNG differ diff --git a/reversed_words.PNG b/reversed_words.PNG new file mode 100644 index 0000000..e833ba3 Binary files /dev/null and b/reversed_words.PNG differ diff --git a/states_capitals_string.PNG b/states_capitals_string.PNG new file mode 100644 index 0000000..5e48e86 Binary files /dev/null and b/states_capitals_string.PNG differ diff --git a/strings.py b/strings.py index 7915338..5963a7e 100644 --- a/strings.py +++ b/strings.py @@ -11,15 +11,28 @@ """ import pytest +a_string = 'monty pythons flying circus' + def no_duplicates(a_string): + + return "".join(sorted(set(a_string))) pass def reversed_words(a_string): + + s = str.split(a_string) + return s[::-1] pass def four_char_strings(a_string): + + slice = [] + + for index in range(0, len(a_string), 4): + slice = a_string[index:index+4] + print(slice , end=' ') pass