Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started