Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

An IP address is a set of four numbers that identifies a device on the internet or a local area network. These four numbers are

An IP address is a set of four numbers that identifies a device on the internet or a local area network. These four numbers are separated by period (.) when written in decimal representation. The four numbers are whole numbers limited from 0 up to 255. An IP address is valid if it consists of four numbers (limited from 0 up to 255) with periods in between (e.g.,192.168.0.1). Develop a function that will return a tuple of valid IP addresses in a given text.
import string
txt1= "Hello my ip address is 192.167.1.1 and I always listen to the radio 92.5. I know a lot about"\
"IP addresses and that 19.255.244.212 is a valid ip and 256.300.12.12 is not."
txt2= "Hackers get the IP address of people ... but I am not a hacker so I just ask them about it."\
"Sometimes they say 2.3.4.1 or 19.23.110.45. Others say 90.4532.22.345 but I know its wrong."
def list_valid_ip(text):
# This function extracts valid IP address from a given text
# YOUR CODE HERE
raise NotImplementedError()
txt1 should return ('192.167.1.1','19.255.244.212')
txt2 should return ("2.3.4.1","19.23.110.45")An IP address is a set of four numbers that identifies a device on the internet or a local area network. These four numbers are separated by period (.)
when written in decimal representation. The four numbers are whole numbers limited from 0 up to 255. An IP address is valid if it consists of four numbers
(limited from 0 up to 255) with periods in between (e.g.,192.168.0.1). Develop a function that will return a tuple of valid IP addresses in a given text.
In []: import string
txt1= "Hello my ip address is 192.167.1.1 and I always listen to the radio 92.5. I know a lot about"\
"IP addresses and that 19.255.244.212 is a valid ip and 256.300.12.12 is not."
txt2= "Hackers get the IP address of people ... but I am not a hacker so I just ask them about it."\
"Sometimes they say 2.3.4.1 or 19.23.110.45. Others say 90.4532.22.345 but I know its wrong."
def list_valid_ip(text):
# This function extracts valid IP address from a given text
# YOUR CODE HERE
raise NotImplementedError()
In []: # DO NOT MODIFY, THIS IS UNIT TESTING! [1 pt]
from nose.tools import assert_equal
assert_equal(list_valid_ip(txt1),('192.167.1.1','19.255.244.212'))
In []: # DO NOT MODIFY, THIS IS UNIT TESTING! [1 pt]
from nose.tools import assert_equal
assert_equal(1ist_valid_ip(txt2),("2.3.4.1","19.23.110.45"))
In []: # HIDDEN TEST [1 pt]
In []: # SAMPLE TEST, DO NOT MODIFY, JUST EXECUTE ONLY FOR OUTPUT
# You can add a cell below if you need to test a different input
print(list_valid_ip(txt1))
print(list_valid_ip(txt2))
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sql++ For Sql Users A Tutorial

Authors: Don Chamberlin

1st Edition

0692184503, 978-0692184509

More Books

Students also viewed these Databases questions

Question

How do the events of the story follow or challenge the script?

Answered: 1 week ago

Question

what is the most common cause of preterm birth in twin pregnancies?

Answered: 1 week ago

Question

Which diagnostic test is most commonly used to confirm PROM?

Answered: 1 week ago

Question

What is the hallmark clinical feature of a molar pregnancy?

Answered: 1 week ago

Question

2. Are my sources up to date?

Answered: 1 week ago