Skip to content
This repository was archived by the owner on Aug 26, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/isIPAddress.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
def isIPAddress(address):
# IP Address is of the form x1.x2.x3.x4
# where all x1, x2, x3, x4 are greater than or equal to zero and less than equal to 255
numbers = address.split('.')
isIP = True
for word in numbers:
if word.isdigit()==False:
isIP = False
break
else:
number = int(word)
if number>255 or number<0:
isIP = False
break
if len(numbers)!=4:
isIP = False

return isIP


if __name__=='__main__':
address = input()
isIP = isIPAddress(address)
print(isIP)