Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 2 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
57 changes: 34 additions & 23 deletions StateCap.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,48 +70,59 @@


def capital_of_Idaho():
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7% of developers fix this issue

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.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.

# 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():
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

23% of developers fix this issue

E303: too many blank lines (4)


ℹ️ 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.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.

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__':
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6% of developers fix this issue

E305: expected 2 blank lines after class or function definition, 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.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.

Expand Down