diff options
Diffstat (limited to 'challenge-278/eric-cheung/python/ch-2.py')
| -rwxr-xr-x | challenge-278/eric-cheung/python/ch-2.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/challenge-278/eric-cheung/python/ch-2.py b/challenge-278/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..e173d974d8 --- /dev/null +++ b/challenge-278/eric-cheung/python/ch-2.py @@ -0,0 +1,18 @@ +
+## Example 1
+## strInput = "challenge"
+## charInput = "e"
+
+## Example 2
+## strInput = "programming"
+## charInput = "a"
+
+## Example 3
+strInput = "champion"
+charInput = "b"
+
+if charInput in strInput:
+ nPos = strInput.find(charInput)
+ print ("".join(sorted(strInput[:nPos + 1])) + strInput[nPos + 1:])
+else:
+ print (strInput)
|
