Fix: Ensure all skills are tracked as files, not submodules
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
# HumanEval/161
|
||||
# Loki Mode Multi-Agent Solution
|
||||
# Attempts: 1
|
||||
# Passed: True
|
||||
|
||||
def solve(s):
|
||||
"""You are given a string s.
|
||||
if s[i] is a letter, reverse its case from lower to upper or vise versa,
|
||||
otherwise keep it as it is.
|
||||
If the string contains no letters, reverse the string.
|
||||
The function should return the resulted string.
|
||||
Examples
|
||||
solve("1234") = "4321"
|
||||
solve("ab") = "AB"
|
||||
solve("#a@C") = "#A@c"
|
||||
"""
|
||||
has_letter = any(c.isalpha() for c in s)
|
||||
|
||||
if not has_letter:
|
||||
return s[::-1]
|
||||
|
||||
result = []
|
||||
for c in s:
|
||||
if c.isalpha():
|
||||
result.append(c.swapcase())
|
||||
else:
|
||||
result.append(c)
|
||||
|
||||
return ''.join(result)
|
||||
Reference in New Issue
Block a user