Posts by flpn • 597 points
22 posts
-
0
votes1
answer406
viewsQ: How to uninstall R on linux?
I am trying to uninstall the R from my machine. As I use linux, I used the command sudo apt-get remove r-base and the operation was successfully completed. But after giving the R command on the…
-
-2
votes1
answer308
viewsQ: Web Frameworks: Frontend vs Backend
I would like to know what characterizes/differentiates a web frontend framework from a web backend framework. For example, Django is considered back and Angular is considered front, but what makes…
-
0
votes1
answer507
viewsQ: Django + AJAX - POST 404 (Not Found)
I am trying to implement a Likes system in a Django + AJAX application but when trying to do the operation in question I am getting the following error in the browser console: POST…
-
0
votes1
answer1418
viewsQ: INSTALL_FAILED_UPDATE_INCOMPATIBLE when trying to install apk
I am having this problem when installing on my mobile a new version of an Android application that I am building and, from what I already researched, can be easily solved by uninstalling the old…
-
2
votes1
answer106
viewsQ: Is there any sort algorithm that actually runs on O(n)?
If such an algorithm exists, how is it possible for an algorithm to sort a data collection in linear time even if it falls in the worst possible case (reversed)?
-
2
votes1
answer358
viewsQ: How do I use Firebase as a database in a Django application?
I just created a Django project and would like to use Firebase instead of sqlite as a database. I looked in several places but could not find anywhere how to do the integration. Someone could help…
-
2
votes1
answer835
viewsQ: onClick function does not work properly
I have a very simple application where I want to change the color of the text by clicking the button. Since I want to handle the onClick event directly in the . js file, not in HTML. Could someone…
javascriptasked flpn 597 -
2
votes3
answers9397
viewsA: How to pass arguments by reference in Python?
If you want to change global variables with objects immutable within the scope of a function, you must use the word global to reference the global object. Example: def exemplo_imutavel(): global x x…
-
0
votes2
answers36
viewsA: Separating using + signal while reading user data
Your code does not work with commas because, by commas, you are implicitly creating a tuple (a data structure). In your case, the function input takes a string per parameter, not a tuple. Just in…
-
0
votes2
answers153
viewsA: How to read 4 numbers at once, and such numbers should be separated only by space?
Your code can be written like this: def analisar_situacao(media): if media < 3: print('Reprovado') elif media < 7: print('Prova final') elif media < 9: print('Aprovado') else:…
python-3.xanswered flpn 597 -
1
votes1
answer33
viewsQ: Dictionary running all keys instead of just one
I have in the following code I have a function that performs certain operation according to the parameters passed. Then I have a dictionary serving as switch case, which will serve to define which…
-
1
votes1
answer251
viewsQ: How to reference instance variable with the same name as a local variable in C++?
In C++, how can I reference an instance variable that has the same name as a global variable? For example, in a set method of the following class: class Person { private: string name; public: void…
-
9
votes1
answer4493
viewsQ: How to make a "deep copy" in Python?
Let’s say I have the following code: class Foo: pass foo_list = [Foo() for _ in range(10)] How can I proceed to create a copy of foo_list without the references of both the list and the objects…
-
2
votes1
answer126
viewsQ: What is Python’s First-Class?
The first-class Java language are objects, as nothing can be created in Java without the use of classes. In Haskell, following the same previous criterion, the first-class are functions. In the case…
-
4
votes2
answers2633
viewsQ: What is the difference between the MVC architecture and Django’s MTV?
I wonder if there is any difference in practice between these two architectures.
-
-2
votes2
answers1991
viewsA: How do I determine the number that appears most often and the position it is in?
Here is the solution to the problem in Python 3: def mais_repetido(array): s = set(array) d = {} for i in s: d[i] = 0 for i in s: for j in array: if i == j: d[i] += 1 maior = max(d.values()) chave =…
-
0
votes2
answers147
viewsA: How to make the amount of DIV to adapt
I believe that using the grid system Bootstrap would solve your problem. <div class="row"> <div class="col-md-2"> <!-- Conteúdo--> </div> <div class="col-md-2"> <!--…
-
2
votes2
answers409
viewsQ: How does Python keep the same memory reference as a list after resizing it?
We know the objects of the type list, because they are based on dynamic vectors, it has a maximum internal capacity. We also know that when this total capacity is reached and we want to insert a new…
-
1
votes2
answers5228
viewsA: Typeerror: Calcularsalario() Missing 1 required positional argument: 'Title'
When executing your code the error that was raised was as follows: Attributeerror: 'Teachers' Object has no attribute 'title' This is happening because the objects in your class contain neither the…
-
1
votes1
answer931
viewsA: I want to save in a new txt file a copy of another txt in Python
You can do something like this: with open('test.txt', 'r') as arquivo_existente, open('novo_arquivo.txt', 'w') as novo_arquivo: for linha in arquivo_existente.readlines(): novo_arquivo.write(linha)…
-
0
votes1
answer134
viewsA: Sort widgets on screen with CSS
I believe that using the grid system Bootstrap would solve your problem. <div class="row"> <!-- Primeira linha com 4 botões --> <div class="col-md-3"> <!-- Botão -->…
-
20
votes3
answers719
viewsQ: Why static methods can be called through the "instance" of the Python 3 class?
Let’s say I have the following class: class Person: @staticmethod def hello(): print('Hello!) When performing the operation Person().hello() the method is executed normally. But the method hello…