> ## Documentation Index
> Fetch the complete documentation index at: https://leetcode-py.wisl.dev/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> leetcode-py is a Python LeetCode practice environment generator with one CLI: lcpy. It is not a service or platform.
> Each problem is a directory under leetcode/ with README.md, solution.py, test_solution.py, helpers.py, and playground.ipynb. lcpy gen creates them from JSON templates bundled with the package.
> Examples are backed by tests; copy them verbatim.

# To Lower Case Python Solution with Tests

> Tested Python solution for LeetCode 709 with 16 pytest cases. Generate a practice environment with lcpy.

LeetCode 709, [Easy](/catalog/easy). Topics: [String](/catalog/topics/string). [View on LeetCode](https://leetcode.com/problems/to-lower-case/description/).

Generate this problem as a practice environment: tested reference solution, 16 [parametrized pytest cases](/practice/testing), and a playground notebook:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
lcpy gen -n 709   # by problem number
lcpy gen -s to_lower_case   # by problem name
```

## Problem

Given a string `s`, return *the string after replacing every uppercase letter with the same lowercase letter*.

### Examples

```
Input: s = "Hello"
Output: "hello"
```

```
Input: s = "here"
Output: "here"
```

```
Input: s = "LOVELY"
Output: "lovely"
```

### Constraints

* 1 \<= s.length \<= 100
* s consists of printable ASCII characters.

## Solution

Reference implementation from [solution.py on GitHub](https://github.com/wislertt/leetcode-py/blob/main/leetcode/to_lower_case/solution.py), full suite in [test\_solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/to_lower_case/test_solution.py):

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
class Solution:
    # Time: O(n)
    # Space: O(n)
    def to_lower_case(self, s: str) -> str:
        out: list[str] = []
        for ch in s:
            code = ord(ch)
            out.append(chr(code + 32) if 65 <= code <= 90 else ch)
        return "".join(out)
```

## Complexity

| Time | Space |
| - | - |
| O(n) | O(n) |

## Tags


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.