Skip to content

Commit be440d8

Browse files
committed
Adding Solution for Problem - 1108 - Simple Solution
1 parent 4546cb7 commit be440d8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Defanging IP Address/SimpleSolution.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,12 @@
2121
#Constraints:
2222
#
2323
#The given address is a valid IPv4 address.
24+
25+
class Solution:
26+
27+
def defangIPaddr(self, address):
28+
29+
return address.replace(".", "[.]")
30+
31+
#We have a simple method in python for strings name - .replace, in which the specif character/string could be replaced.
32+
#i.e. str = "1, 2, 3" >> str.replace('2', '4') >> Output will be "1, 4, 3".

0 commit comments

Comments
 (0)