File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed
challenges/how-to-capitalize-a-string Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change
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 )
Original file line number Diff line number Diff line change
1
+ def capitalize (string ):
2
+ return string [0 ].upper () + string [1 :].lower ()
You can’t perform that action at this time.
0 commit comments