Skip to content

Commit 325102b

Browse files
authored
Added Capitalize String Challenge (#49)
* Added template * Updated template * Add files via upload * Create capitalize_string.py * Fixed expected behavior
1 parent 91c5e00 commit 325102b

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## How to Capitalize a String in Python Challenge
2+
3+
The following challenge was described in the article
4+
[How to Capitalize a String in Python](https://therenegadecoder.com/code/how-to-capitalize-a-string-in-python/#challenge).
5+
6+
### Challenge Description
7+
8+
Write a function which returns a copy of the string with its first character capitalized and the rest lowercased.
9+
10+
### Expected Behavior
11+
12+
```python
13+
capitalize("howdy") # returns "Howdy"
14+
capitalize("shRUb") # returns "Shrub"
15+
```
16+
17+
### Example Solution
18+
19+
![Solution](solution.jfif)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def capitalize(string):
2+
return string[0].upper() + string[1:].lower()
Binary file not shown.

0 commit comments

Comments
 (0)