Posts by darcamo • 344 points
17 posts
-
0
votes1
answer222
views -
1
votes1
answer36
viewsA: Ellipsis in numpy array
He does not "return" .... When the array has a number of elements greater than a certain threshold (the default value is 1000) the numpy places ... just to say that it has more elements that it is…
-
0
votes2
answers51
viewsA: C++ - pointer this
Thus, temp is the result of concatenation between a scale operation and rotation. This seems very confusing and is creating an unnecessary copy because what you are returning in each of these…
-
0
votes1
answer34
viewsA: C++ - Code problem
You are creating a class containing the variable guess. The problem is that within the class methods you declare a another variable place with the same name. That is, if you change the value of…
-
0
votes1
answer220
viewsA: Copy one string to the other in C++
In c++ std::string already follows the lexicographic order. That is, just compare with the relational operators as <, >, etc. The only care you should take is that it differentiates between…
-
0
votes1
answer107
viewsA: An exercise in python but I could not understand the logic
In python you can use the files .py in two ways. Either you run them (the file will be a "script"), or you import functions, classes, etc., from that file (the file will be a module). In the case of…
-
0
votes1
answer505
viewsA: Memory allocation error for multiple files "terminate called after Throwing an instance of 'Std::bad_alloc' what(): Std::bad_alloc" [C++]
Something easy you can try is to use vector floats instead of vector doubles to store the values. This will cut in half the memory your vector uses and it may be that the loss of accuracy is not a…
-
0
votes1
answer497
viewsA: Identify if a matrix is triangular upper, lower or diagonal
I find it easier to assume that the matrix is higher and lower and prove otherwise in each case. To check if the matrix is not lower just check if there is any element in an index column larger than…
-
2
votes1
answer34
viewsA: What was my mistake?
The last else that matches the last if must have the same indentation as the if.
-
0
votes2
answers2626
viewsA: How to make a "procv" in Python using the Pandas library
You can group by name to join each person’s thoughts and then iterate into the groups to get the data. From this build a new dataframe. sales.txt File Nome,Vendas,Produto,Data…
-
1
votes1
answer107
viewsA: C++ - Std::Hex is not returning hexadecimal value
The reason is that the cout is treating the guy std::uint8_t as if it were a char when printing, rather than a unsigned int. Because of this so much the std::hex as to the std::uppercase has no…
-
0
votes1
answer1798
viewsA: ERROR C++ - [Error] ISO C++ forbids comparison between Pointer and integer [-fpermissive]
Realize that int cpf[SIZE][50] is a 2D array. Therefore, by indexing only once the result will be a pointer to integer (since the resulting 1D array degenerates to a pointer), not an integer. This…
-
8
votes1
answer85
viewsA: How is it possible for the same memory address to have 2 different values at the same time?
It’s like the same memory address has two values... How is that possible? The short answer is: This is not possible. It turns out that when you had the variable value printed a your program did not…
-
0
votes1
answer205
viewsA: Solved - Error running the program, please help. terminate called after'Std::bad_alloc'
std::bad_alloc is an exception that occurs when it is not possible to allocate memory to create an object. One thing that’s got me intrigued is your job telaInicio be recursive and see no reason for…
-
0
votes1
answer189
viewsA: Update Python 3x
Python that comes in the system is used, among other things, to run the various applications that are installed and that have been made in Python. Of course you can use it to code in Python, but…
-
-1
votes5
answers9733
viewsA: playing mp3 files in Python
The code you used with the pygame should work. Your error may not be related to pygame. The file McPoze.mp3 exists and is in the same folder where interpreter was opened? You can check the current…
-
1
votes1
answer280
viewsA: Place numbering on graph curves (matplotlib)
You can use plt.text to place a text in a specific location. import numpy as np import matplotlib.pyplot as plt T = np.linspace(0, 100, 1000) L=[10,20,30] fig1=plt.figure() for l in L: y = T+2*l…