Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import re; import sys; def rgex(string, pattern): string = re.findall(pattern, string); a = for x in string: a+=x; return (a); def norm(string): string =

import re; import sys;

def rgex(string, pattern): string = re.findall(pattern, string); a = "" for x in string: a+=x; return (a); def norm(string): string = rgex(string, r'[a-zA-Z0-9]* ?'); string = rgex(string, r'\w{4,} ?');

return string.lower(); def jac(st1, st2): leno = min(len(st1), len(st2)); count = 0; for i in range(leno): if(st1[i]==st2[i]): count+=1; return count/(len(st1)+len(st2)-count)

def main(): string1 = norm(input()); string2 = norm(input()); print(jac(string1, string2));

if __name__ == "__main__": main()

achieve the same functionality without using the rgex function

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

Step: 3

blur-text-image

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

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions