ankara escort
malatya escort
Python Exercises

Python: Valid an IP address

Python Basic: Exercise-139 with Solution

Write a Python program to valid an IP address.

Sample Solution:-

Python Code:

import socket
addr = ''
    print("Valid IP")
except socket.error:
    print("Invalid IP")

Sample Output:

Invalid IP  

Python Code Editor:


Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a Python program to convert true to 1 and false to 0.
Next: Write a Python program to convert an integer to binary keep leading zeros.

What is the difficulty level of this exercise?

New Exercises:R Programming