Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5b23dc9

Browse files
author
Amogh Singhal
authored
Create remove_dup_chars.py
1 parent 69812cf commit 5b23dc9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

‎remove_dup_chars.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Remove duplicate characters from string
2+
3+
def remove_dup_chars(input_str):
4+
dedupe_str = ''
5+
6+
for char in input_str:
7+
if char not in dedupe_str:
8+
dedupe_str += char
9+
10+
return dedupe_str
11+
12+
result = remove_dup_chars("zmaxxazkgv")
13+
print(result) # zmaxxazkgv

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /