Question: Python [1] Write a function random_text(m) that returns a random text of n characters in upper-case characters. Use lorem-text as described in pypi.org/project/lorem-text/ and the

Python

[1] Write a function random_text(m) that returns a random text of n characters in upper-case characters. Use "lorem-text" as described in pypi.org/project/lorem-text/ and the function upper(). If you are using another programming language, please locate something equivalent.

[2] Write a function random_pattern(n, text) that returns a random pattern within the text. Generate a random index idx between 0 and len(text) - n, and then return text[idx:idx+n]. Remember that index so you can compare it to the index found by the search algorithms. (Generally n, the size of the pattern, will be small compared to m, the size of the text.)

from lorem_text import lorem 

import random

def random_text(m):

# need help fixing this

def random_pattern(n, text):

# need help fixing this

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!