Skip to content

Commit

Permalink
Update solution.py
Browse files Browse the repository at this point in the history
 sourcery-ai bot 4 minutes ago
suggestion (performance): Convert string to lowercase once before the loop for better performance

string.lower() is being called for each iteration. Converting to lowercase once before the loop would be more efficient.
  • Loading branch information
ikostan committed Jan 1, 2025
1 parent a159ea7 commit bf4c960
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kyu_8/strange_trip_to_the_market/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ def is_loch_ness_monster(string: str) -> bool:
"""
# A) it is a 400-foot tall beast from the paleolithic era;
# B) it will ask you for tree fiddy.
return any(True for s in INDICATIONS if s in string.lower())
string = string.lower()
return any(True for s in INDICATIONS if s in string)

0 comments on commit bf4c960

Please sign in to comment.