Skip to content

Commit

Permalink
Update solution.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ikostan committed Dec 30, 2024
1 parent 4b117f3 commit 9a9d23d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions kyu_7/pointless_farmer/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ def buy_or_sell(pairs: list, harvested_fruit: str) -> list[Any] | str:

for pair in pairs:
# First item in pairs is for selling, second is for buying.
if pair[0] == currently_holding == pair[-1]:
results.append('sell')
elif pair[-1] == currently_holding:
if pair[0] == currently_holding == pair[-1] or pair[-1] == currently_holding:
results.append('sell')
currently_holding = pair[0]
elif pair[0] == currently_holding:
Expand Down

0 comments on commit 9a9d23d

Please sign in to comment.