Posts by Fernando Cavendish • 51 points
4 posts
-
3
votes2
answers275
viewsQ: How to write a program that fills a 10-position vector with random integers between 0 and 20?
How do I create a vector v of 10 random elements in which each element is one whole between 0 and 20? I tried to use the function np.random.random((1,10)), but the output was a vector of decimal…
-
0
votes2
answers46
viewsQ: Print a new vector by changing the order of the elements of the original vector
How do I change the order of the elements of a vector v1 printing a new vector v2 with these changes? You can write a function def? Example: v1 = [2,51,68,10] v2 = [10,2,51,68]…
-
-1
votes1
answer74
viewsQ: How to ask the user to create an np.array vector?
I would like to know HOW is it possible to write a program that reads an array numpy vector np.array([]) user-created. In lists, for example, we do: n = int(input("Determine o número elementos da…
-
1
votes3
answers166
viewsQ: how to find the indexes of an item that repeats in a list in Python
have a list l = [1,6,6,2,3,6] and I want to form another with all the indexes of the element 6. In this case, the second list should be l2 = [1,2,5], however, when I try to use the l.index(6),…