Posts by prm • 95 points
4 posts
-
0
votes1
answer348
viewsQ: C vector product with file input . dat
Be the code below, where the input vector.dat file, on each line, has 6 numbers where the first 3 are components of a vector "u" and the last 3 are components of a vector "v". The vector.dat output…
-
3
votes1
answer149
viewsQ: In what order does a class inherit from its python superclasses?
Be the code below: class B(A): def __init__(self): self.c = 16 def y(self): print("B.y") def get_c(self): return self.c class C(object): def __init__(self): self.c = 5 def y(self): print("C.y") def…
-
5
votes1
answer4065
viewsQ: Python, clone the lists
Be the code below: def modif1(lista): lista = [4,5,6] lista = [1,2,3] modif1(lista) print(lista) #resultado: [1,2,3] def modif2(lista): lista[0] = 4 lista[1] = 5 lista[2] = 6 lista = [1,2,3]…
-
1
votes1
answer79
viewsQ: How to modify a list in the global Scope using a function? Python 3
def lsum(x): res = [] for i in x: res.append(x+1) L = res L = [1,2,4] lsum(L) print(L) How can I modify the above code without using global L to print("L") "return" [2,3,5]? That is, I want to…