-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path049_Double Char.py
52 lines (34 loc) · 972 Bytes
/
049_Double Char.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""
Codewars Coding Challenge
Day 49/366
Level: 8kyu
Double Char
Given a string, you have to return a string in which each character (case-sensitive) is repeated once.
Examples (Input -> Output):
* "String" -> "SSttrriinngg"
* "Hello World" -> "HHeelllloo WWoorrlldd"
* "1234!_ " -> "11223344!!__ "
Good Luck!
def double_char(s):
pass
https://www.codewars.com/kata/56b1f01c247c01db92000076/train/python
"""
# My Solution
def double_char(s):
res = ""
for i in s:
res += i * 2
return res
print(double_char("Beno"))
"""
Sample Tests
import codewars_test as test
from solution import double_char
@test.describe("Fixed Tests")
def fixed_tests():
@test.it('Basic Test Cases')
def basic_test_cases():
test.assert_equals(double_char("String"),"SSttrriinngg")
test.assert_equals(double_char("Hello World"),"HHeelllloo WWoorrlldd")
test.assert_equals(double_char("1234!_ "),"11223344!!__ ")
"""