Question: IN PYTHON An IP address (internet protocol address) is a unique number assigned to all devices (computer, tablet, phone, etc.) when the internet is connected.

IN PYTHON

An IP address (internet protocol address) is a unique number assigned to all devices (computer, tablet, phone, etc.) when the internet is connected. Your task is that, given an IP you have to say if it is valid or not. A valid IP consists of 4 numbers (each between 0 and 255) separated by periods. For example 0.0.0.0 to 255.255.255.255 Write a function called valida_ip (ip) that receives a string representing an ip that returns True or False (Boolean) depending on whether the IP is valid or not.

EXAMPLE:

0.0.0.0

OUTPUT

True

EXAMPLE 2:

255.255.255.255

OUTPUT

True

EXAMPLE 3:

127.300.1.2

OUTPUT

False

Example 4.

127.abc.1.xyz

OUTPUT:

False

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!