Update snippet descriptions

This commit is contained in:
Isabelle Viktoria Maciohsek
2020-11-02 19:28:27 +02:00
parent 0a2f7993f7
commit 98b5f67412
23 changed files with 68 additions and 59 deletions

View File

@ -5,12 +5,12 @@ tags: string,math,intermediate
Converts the values of RGB components to a hexadecimal color code.
- Create a placeholder for a zero-padded hexadecimal value using `"{:02X}"`, copy it three times.
- Create a placeholder for a zero-padded hexadecimal value using `'{:02X}'` and copy it three times.
- Use `str.format()` on the resulting string to replace the placeholders with the given values.
```py
def rgb_to_hex(r, g, b):
return ("{:02X}" * 3).format(r, g, b)
return ('{:02X}' * 3).format(r, g, b)
```
```py