Skip to content

Avip sol #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions StateCap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Binary file added String_four_char.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added all_capitals.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added capital_of_idaho.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added get_states.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added no_duplicate.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added reversed_words.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added states_capitals_string.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down