Posts by ABSoares • 47 points
3 posts
-
2
votes1
answer2994
viewsQ: Return the position of a word in a string
Could someone help me with this question? def fileRead(file): txt = open(file) print(txt.read()) def index(filepath, keywords): with open(filepath) as f: for lineno, line in enumerate(f, start=1):…
-
1
votes1
answer7755
viewsQ: Matrix (Create 2 Matrices and Sum them)
How could I build this matrix without using Random/randit? Then I need to do the function sum element by element, of the first two. The sum shall be settled via written sub-programme for that…
python-3.xasked ABSoares 47 -
1
votes1
answer1139
viewsQ: Creation of a random vector
from random import randint # para gerar os nums aleatorios def criaVetor(L, H, tam): vec = [] for i in range(tam): # vamos fazer isto tam (N) vezes vec.append(randint(L, H)) # gerar numero aleatorio…