Posts by Eder Lima • 436 points
20 posts
-
-1
votes1
answer45
viewsA: How does the sum assignment operator work internally?
Operators + and += have different implementations when you use += (__iadd__) on an object of the type list the original list is mutated, so the memory reference remains. Already the operator +…
-
0
votes2
answers75
viewsA: How to stop a for in Elixir?
What you want to do is what we call Return Early that you can read here. In the functional paradigm we do not usually use conventional repeating structures of object-oriented or structural…
-
2
votes1
answer31
views -
0
votes2
answers113
viewsA: How to use alphabet range in python?
For this you can use the global functions of Python as a chr. # Quantidade de linhas value = int(input("Digite: ")) # Executa a quantidade de vezes digitada # inicialmente, para cada nova iteração #…
-
0
votes1
answer54
viewsA: Doubt in the use of the for
To do this just decrease the maximum capacity of the basket in the total amount of fruit at each loop iteration, example: quantity of fruit = 12 basket capacity = 6 First iteration: 12 - 6 = 6…
-
2
votes1
answer47
viewsA: Difference between Function and Function
function is a Javascript keyword used to define a new function, already the Function references the class. Javascript functions are first class objects, each function you create is a new object.…
-
1
votes2
answers39
viewsA: Scroll through a string list and display the 2 in 2 result
The best solution for this is to use Slices of the list. seguidores = ["teste", 'teste2', 'teste3', 'teste4', 'teste5'] tamanho = len(seguidores) # Índice aumenta em 2 a cada iteração for indice in…
-
3
votes1
answer42
viewsA: Insert a success message after Location.Reload()
For this the page needs to store a state if the project has been saved successfully, unfortunately while reloading the page you wipe all the data from your application. What you can do is save if…
-
0
votes1
answer42
viewsA: I am trying to make a favorite button in the js Act, that by clicking the icon with the classname"far fa-Heart" it changes to classname"fas fa-Heart"
There are some ways to do this by following what you were doing would look like this: import Cama from "cama.png"; import React from "react"; import styles from "./styles.module.scss"; export…
-
0
votes1
answer91
viewsA: Calculating Leap Year of Year Beginning to Final Year
Your code was on the right track, to count the number of leap years what you had to check is whether the year module 4 was equal to zero. Corrected code: ano_inicio = int(input("Digite o ano: "))…
python-3.xanswered Eder Lima 436 -
0
votes1
answer33
viewsA: Menu with upper margin
The CSS comes with some preset things, this upper margin comes because of these settings. Use this from here to reset your CSS /* Reset */ * { padding: 0; margin: 0; box-sizing: border-box; } .barra…
-
-1
votes1
answer35
viewsA: Early programming
Your program is not running because on your parole you are comparing response to sim, where yes should be a string using quotes. Corrected print("Exercício 02: ") print("O maior rio em extensão…
-
3
votes1
answer23
viewsA: How to run WEP API Node and a Reactjs Project on the same machine?
You can change this behavior by downloading some extensions to your browser, but in general it is advisable that on your server you send in the response header the value Access-Control-Allow-Origin,…
-
0
votes1
answer35
viewsA: Storing an input field value in a localStorage
The value appears as null because its input does not have id, also in function Value1 you are using localStorage.getItem, used to fetch a value saved on localStorage. Refactored code: <!DOCTYPE…
-
0
votes1
answer170
viewsA: Because when I install Axios in my next application I can’t run it?
The mistake is in yours package.json, the script dev is as: { "dev": "next" } When it should be: { "dev": "next dev" }…
-
1
votes1
answer55
viewsA: How to make an Scores hanking of a javascript game
The solution has become a bit extensive but I imagine you understand a lot of the problem. /** * @typedef Score Pontuação de um usuário * @property {number} id ID da pontuação do usuário * @property…
-
0
votes1
answer32
viewsA: button event in React.JS
In this case the ideal would be a conditional rendering. When a variable in your program is true, render the graph. We can do this with the hook useState react. const Dashboard = () => { //…
-
2
votes1
answer54
viewsA: How to compare only dates in Sequelize?
You can use the sequelize.fn to convert a datetime for date. sequelize.fn("date", myRepository.dt_end); The function will convert the 2021-05-06 03:00:00.0000000 +00:00 for 2021-05-06. Take a look…
-
-1
votes1
answer31
viewsQ: How to filter form options by foreign key? - Django Admin
I need to show only objects that have the same foreign key company in Django in the admin view. What I got was to show only the related objects using get_queryset, but in the form fields appear all…
-
1
votes1
answer79
viewsA: State returning late value in Click
To explain why this happens, we first have to understand that setState occurs asynchronously, i.e.: When you run the console.log() by clicking the button, the value that will always be shown will be…