[Solved] How to generate a random word

you should import your Module or external library first. and random module dose not have random.str() function! Try This : import random a = [‘blue’, ‘red’, ‘green’, ‘yellow’, ‘brown’, ‘black’] print(random.choice(a)) Good Luck. 1 solved How to generate a random word

[Solved] How to extract data from formatted string using python?

You should certainly read more on regex. A first hint is that when you want to capture a pattern you need to enclose it in parentheses. e.g. (\d+). For this example though, the code you need is: match = re.match(r’C(\d+)([F|G])(\d+)\.PNG’, s) first_id = match.group(1) fg_class = match.group(2) second_id = match.group(3) 1 solved How to extract … Read more

[Solved] Could not install packages due to an EnvironmentError: 404 Client Error [closed]

You are missing -r command flag, so go again with pip install -r requirements.txt As it was before, pip just tries to get requirements.txt from remote store expecting it to be a package name. See pip help install Usage: pip install [options] <requirement specifier> [package-index-options]… pip install [options] -r <requirements file> [package-index-options]… … pip also … Read more

[Solved] What is a regex that would match using the word نيك alone and not when combined with other words like الهندسة الميكانيكية [duplicate]

What is a regex that would match using the word نيك alone and not when combined with other words like الهندسة الميكانيكية [duplicate] solved What is a regex that would match using the word نيك alone and not when combined with other words like الهندسة الميكانيكية [duplicate]

[Solved] please help me with this python exercise [closed]

inp = [[0,1,2,3,4,5], [0,1,2,3,4,5], [0,1,2,3,4,5]] # out = [0****0, *1**1*, **22**] out = [] # here we create a list for finale output, now it’s empty count = 0 #this variable count we use for knowing what is the index iterable element for i in inp: # ordinary for loop, we eterate inp. on first … Read more

[Solved] I want to display words separate from a sentence

sentence = “Get a sentence from the user and display it back with one word per line.” for character in range(len(sentence)): if sentence[character] == ‘ ‘ or sentence[character] == ‘.’ or sentence[character] == ‘,’: print(“”) else: print(sentence[character], end=”) OUTPUT: Get a sentence from the user and display it back with one word per line solved … Read more

[Solved] Print function values [closed]

import numpy as np x_range = np.arange(-3, -0.8, 0.2) for x in x_range: y = (x**2)/2 – 4*x print(“{:.2f} -> {:.2f}”.format(x, y)) if you want to store the y values for each x: import numpy as np x_range = np.arange(-3, -0.8, 0.2) y_vals = [] for x in x_range: y = (x**2)/2 – 4*x y_vals.append(y) … Read more

[Solved] Not importing shape in python

the logic of the posted code is flawed, you set the turtle object at the beginning and it appears (as it should). but then you use an endless loop that update the object but there is nothing to update. so the code after the loop is never executed -> no shape will appear So doing … Read more