Question: you will create single Python file which will define a single function (recognize_ip_address).The recognize_ip_address function will take only a string as its argument (string), and

you will create single Python file which will define a single function (recognize_ip_address).The recognize_ip_address function will take only a string as its argument (string), and will return True if the string is made up of exactly four sequences of 1-3 digits, separated by a period (.).

Note:You must use regular expressions to solve this problem.

Use the code, below, as a starting point.For the given lists, the output should be as shown.However, your code should also work (and will be tested with) other lists.

importre

#YOURCODEGOESHERE

str1='1.2.3.4'

print(f'recognize_ip_address({str1})=>',recognize_ip_address(str1))

str2='255.255.255.255'

print(f'recognize_ip_address({str2})=>',recognize_ip_address(str2))

str3='173.201.64.8'

print(f'recognize_ip_address({str3})=>',recognize_ip_address(str3))

str4='23.64.18.201.3'

print(f'recognize_ip_address({str4})=>',recognize_ip_address(str4))

str5='201.1295.6.14'

print(f'recognize_ip_address({str5})=>',recognize_ip_address(str5))

str6='38.126.84'

print(f'recognize_ip_address({str6})=>',recognize_ip_address(str6))

'''

expectedoutput:

recognize_ip_address(1.2.3.4)=>True

recognize_ip_address(255.255.255.255)=>True

recognize_ip_address(173.201.64.8)=>True

recognize_ip_address(23.64.18.201.3)=>False

recognize_ip_address(201.1295.6.14)=>False

recognize_ip_address(38.126.84)=>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 Programming Questions!