-
Notifications
You must be signed in to change notification settings - Fork 68
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
first try #25
base: master
Are you sure you want to change the base?
first try #25
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -70,48 +70,59 @@ | |||||||||
|
||||||||||
|
||||||||||
def capital_of_Idaho(): | ||||||||||
# Your code here | ||||||||||
capital = 'Boise' | ||||||||||
for i in STATES_CAPITALS: | ||||||||||
if STATES_CAPITALS[i] == capital: | ||||||||||
print('Q1:', STATES_CAPITALS[i]) | ||||||||||
pass | ||||||||||
|
||||||||||
def all_states(): | ||||||||||
# Your code here | ||||||||||
state = list(STATES_CAPITALS.keys()) | ||||||||||
print('Q2:', state) | ||||||||||
pass | ||||||||||
|
||||||||||
def all_capitals(): | ||||||||||
# Your code here | ||||||||||
capitals = list(STATES_CAPITALS.values()) | ||||||||||
print('Q3:', capitals) | ||||||||||
pass | ||||||||||
|
||||||||||
|
||||||||||
def states_capitals_string(): | ||||||||||
# Your code here | ||||||||||
list = [] | ||||||||||
for state, capital in STATES_CAPITALS.items(): | ||||||||||
list.append(state) | ||||||||||
list.append('->') | ||||||||||
list.append(capital) | ||||||||||
list.append(',') | ||||||||||
string = ' '.join(list) | ||||||||||
print('Q4:', string) | ||||||||||
pass | ||||||||||
|
||||||||||
|
||||||||||
|
||||||||||
def get_state(capital): | ||||||||||
pass | ||||||||||
|
||||||||||
|
||||||||||
|
||||||||||
def test_state_to_capital(): | ||||||||||
assert 'Cheyenne' == STATES_CAPITALS['Wyoming'] | ||||||||||
capital_input = capital | ||||||||||
state_input = '' | ||||||||||
flag = 0 | ||||||||||
for state, capital in STATES_CAPITALS.items(): | ||||||||||
if capital == capital_input: | ||||||||||
state_input += state + ' ' | ||||||||||
flag = 1 | ||||||||||
if flag == 0: | ||||||||||
state_input = 'State not exist' | ||||||||||
return state_input | ||||||||||
|
||||||||||
|
||||||||||
def test_state_to_capital_unknown(): | ||||||||||
with pytest.raises(KeyError): | ||||||||||
STATES_CAPITALS[''] | ||||||||||
|
||||||||||
|
||||||||||
def test_capital_to_state(): | ||||||||||
assert 'Wyoming' == get_state('Cheyenne') | ||||||||||
|
||||||||||
|
||||||||||
def test_capital_to_state_unknown(): | ||||||||||
with pytest.raises(KeyError): | ||||||||||
get_state('') | ||||||||||
|
||||||||||
|
||||||||||
def main(): | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. E303: too many blank lines (4) ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. |
||||||||||
return pytest.main(__file__) | ||||||||||
capital = input("Write a capital and we will tell you the state:") | ||||||||||
print("the state is: ", get_state(capital)) | ||||||||||
|
||||||||||
capital_of_Idaho() | ||||||||||
all_states() | ||||||||||
all_capitals() | ||||||||||
states_capitals_string() | ||||||||||
|
||||||||||
|
||||||||||
if __name__ == '__main__': | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. E305: expected 2 blank lines after class or function definition, found 1 ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. |
||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E302: expected 2 blank lines, found 1
ℹ️ Expand to see all @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
@sonatype-lift ignore
@sonatype-lift ignoreall
@sonatype-lift exclude <file|issue|path|tool>
file|issue|path|tool
from Lift findings by updating your config.toml fileNote: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.