Posts by Bernardo Lopes • 892 points
58 posts
-
0
votes1
answer26
viewsA: Problem changing characters of an array
You have a burst of indices at the narrowness of your matrix. On the line [8,0], the condition matriz[i][j-1] looking for a position that does not exist in the case j-1, where j = -1, this occurs in…
-
1
votes1
answer32
viewsA: INNER JOIN with SOMA - SQL
The solution presented is for the two tables below, same problem presented by changing the name of the tables and the columns. **tabela1** cpf valor 12345678910 10 01987654321 20 **tabela2** cpf…
-
1
votes3
answers79
viewsA: Greatest prime number
Initially check if a number is prime, this is done in the second if inside while, and if the prime increments the primes quantity c, check that this prime number is greater than the maior if so…
-
1
votes1
answer26
viewsA: The program just gives me back the list again, without me being able to enter the values, what am I doing wrong?
Your code is correct the problem is the fact the switch is outside the while block, just put it inside the while. The way it is the code only enters the switch when it exits the loop, that is when…
-
1
votes1
answer89
viewsQ: Filter Dataframe pandas with two or more conditions
I am creating a chart with dataset tips, for this I need to filter the data based on two or more conditions. My goal is to count the number of men, and the number of women. And also count only the…
-
1
votes1
answer98
viewsA: JOKENPO game can only end when player or computer win 3 matches
I initialized the variables int pontosJogador=0; int pontosComputador=0; put the score counters in a loop while until one of the players scores 3. As long as the two players score less than 3 the…
canswered Bernardo Lopes 892 -
1
votes1
answer49
viewsQ: PDO does not return error even in a Try catch block
I was trying to register in a mysql database using PDO. Do not register but even so I did not have an error return despite the block try catch. I later discovered that the error was the column size…
-
0
votes2
answers266
viewsA: FILL MATRIX WITH PYTHON RANDOM VALUES
The list valores has a list of the random numbers to be generated. Random generates values in the range 0 to the number number in valores, and when the Dice value is generated it is removed from the…
pythonanswered Bernardo Lopes 892 -
1
votes1
answer45
viewsA: Traversing matrix and summing the values
const arr = [ [11, 2, 4], [4, 5, 6], [10, 8, -12] ] function diagonalDifference(arr) { let diagonal1 = 0; let diagonal2 = 0; const len = arr.length; arr.forEach((elemento, ind) =>{ diagonal1 +=…
-
0
votes1
answer35
viewsA: How to remove this margin with bootstrap ? I already used m-0 but it doesn’t work
<html> <head> <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"…
-
1
votes1
answer33
viewsA: Proper fraction, improper and apparent in C language
Note that your condition for a fraction to be improper is only accurate numerador >= denominador and to be apparent this same condition must be verified beyond the condition numerador %…
-
0
votes1
answer87
viewsA: Python - List sorting without Sort()
This code take the values of lista and goes putting in ordenado. In the first iteration of for ordenado is empty then, the instruction jumps to the else and add value 11 in ordenado. In the second…
-
0
votes1
answer36
viewsA: how do I see the total
Create a variable total. For each click on the buttons that increases the amount, put this code total += contador1 * preco. Change the name of the counter1 to the correct variable. For each click on…
-
0
votes2
answers160
viewsA: Help with PYTHON lists
1 - The while controls the entry between 10000 and 30000. 2 - Convert variable to string to access digits separately. 3 - Place in the vaiavel resultado each digit separately. 4 - Place in the…
-
1
votes2
answers134
viewsA: Make a program that calculates the value of H*S, being:
The somatorios are wrong. Note that H = 1/1 + 3/2 + 5/3..., i.e., while the numerator of the fraction (the top one) starts at 1 and increases by 2, the denominator will increase by 1 in 1. Be aware…
javaanswered Bernardo Lopes 892 -
4
votes3
answers220
viewsA: How to popular a dynamically key and value dictionary?
You declared a list and not a dictionary. Dictionary is declared with {} n = int(input("Digite o valor de n:")) dicionario = {} for x in range(1,n+1): dicionario[x] = x ** 2 print(dicionario)…
-
-2
votes1
answer35
viewsA: Sum a column by Mysql ranges
As each student has a single enrollment, Cvoce can group the data by enrollment, so in your result will have the number of lines equal to the number of right enrollments, ie a line for each student.…
-
0
votes1
answer48
viewsA: Python - List Creation
The mistake is both for. Instead of adding the names and weights of the animals, you are just creating the variables and putting the values in it, that within a for then, at each iteration the…
-
0
votes3
answers123
viewsA: Problem when denying receipt of a certain value
A more practical way to avoid notes outside the ranges 0 - 10, is to use a while that forces the user to type the note within the range. n1 = float(input('Digite sua primeira nota:')) while not(n1…
-
0
votes2
answers63
viewsA: Error in printing C numbers
#include <stdio.h> #include <stdlib.h> int maiorValor(int array[], int q); int main() { int N = 1, k; printf("Qual o tamanho do array: "); scanf("%d", &N); int vetor[N];…
canswered Bernardo Lopes 892 -
0
votes4
answers276
viewsA: Prime numbers with Python
A number is prime when it is divisible by 1 and by itself. The variable ePrimo shall count the number of number, if this amount is exactly equal to 2 then number % i == 0 was only true in two…
-
2
votes1
answer39
viewsA: Calculate the product within a for loop
The sum variable must be initialized soma = 0 and also the variable produto = 1. Otherwise they’ll be getting garbage and the calculations go wrong. #include <stdio.h> int main() { int num,…
-
1
votes2
answers59
viewsA: Program prints the next letter of the alphabet instead of the next char on the pointer
As you stated only a pointer *p char. Progamma is only storing the first position, that is the letter 'O'. When increments p++, Voce is not jumping to the next memory address, it is only increasing…
-
7
votes1
answer126
viewsQ: How to change the color when drawing a line segment that belongs to a circle?
I’m trying to draw in an image 400 × 400. The first drawing is a line defined by the equation ax + by + c = 0. When to replace x and y and the result is 0 the point belongs to straight, then change…
-
2
votes1
answer218
viewsQ: Check if it is vowel or consonant and if it is lowercase or uppercase without using ready-made functions
I am developing two functions in C language, the first to check whether a letter is a vowel or a consonant, without using any ready function. The first is working. The second function checks whether…
-
3
votes2
answers79
viewsA: Regular expression for validating string and int in php
if(preg_match('/^(ES)-(\d){4}$/', $let)) This requires, in addition to initializing with ES, to be followed by - and end in 4 digits
-
1
votes1
answer28
viewsA: Error to excrever data frame in Excel
pd.read_html(r.text) returns a list with the tables of the page, then you access the tables by the Dice, in your case the table is in the Indice 0 df = pd.read_html(r.text)[0] df is already a…
pythonanswered Bernardo Lopes 892 -
0
votes2
answers214
viewsA: How to calculate average students and show in percentage?
class Colegio { static void Main(){ double nota1,nota2,nota3,nota4,nota5; int totalAluno = 5; int tAcima = 0; //double[] notas = new double[5]; int[ ] notas = new int[]{ 50, 50, 70, 80, 100 }; for…
-
3
votes4
answers197
viewsA: Python, how to calculate the average of a list of 5 in 5 elements?
One is up to the list size with step 5 in the second to complete the list of five elements (list5) Calculate the sum of the list5 and divide by the size to get the average. lista =…
-
1
votes1
answer343
viewsA: Import CSV files from Drive into Google Collab
Add /content/ before drive from google.colab import drive drive.mount('/content/drive') base = pd.read_csv ('/content/drive/My Drive/Path/Path/DM_ALUNO.csv'')
pandasanswered Bernardo Lopes 892 -
1
votes1
answer495
viewsA: Attributeerror: 'numpy.ndarray' Object has no attribute 'append'
The error is occurring because Voce is converting the lists to the ndarray type on line 28(w1), line 34(w2) and line 55(g). This makes the list (which is now ndarray) lose the method in the next…
-
0
votes1
answer32
viewsA: Return only values from a database row
<tr> <td><?php echo $dado["id"]; ?></td> <td><?php echo $dado["nome"]; ?></td> <td><?php echo $dado["sexo"]; ?></td> <td><?php…
-
4
votes2
answers138
viewsA: Largest and smallest value of each row of the two-dimensional array
public class Strack { public static void main(String[] args) { int[][] arrayValues = { { 21, 33, 70, 16, 70, 80, 67, 21 }, { 54, 93, 36, 80, 48, 41, 14, 5 }, { 6, 91, 81, 14, 37, 91, 98, 35 }, { 51,…
-
0
votes1
answer35
viewsA: Const int instead of number in the vector in C
#include <stdio.h> int main (){ const int Bimestre = 4; const int Numeroaluno = 4; float AlunoBimestre [Bimestre][Numeroaluno]; int media = 0; float…
-
1
votes1
answer77
viewsA: Link PHP to HTML and Calculate how old and months
You need a form, in the form action pass the name of the php file (data.php). The name of the html input fields are the keys in the $_POST['name'] and $_POST['data'] variable. O e explodes…
-
2
votes1
answer177
viewsQ: How to make a #if with comparison of two variables using handlebars and nodejs
My problem is in creating #if with a comparison with two variables on the .handlebars. page In the edition page I retrieve the data and fill in the fields, however in my select, I need to compare…
-
0
votes2
answers35
viewsA: error when searching client
while condition is wrong, in the code if you do a search will enter while and exit loop while(choice!= 0); Only change the condition to 0
canswered Bernardo Lopes 892 -
2
votes1
answer68
viewsQ: Lapis design effect with opencv and python
I want to get the result of the image further to the right, so I can only get to the middle image using a Canny filter and a Gaussian filter. Does anyone know how I can get this result? import cv2…
-
1
votes1
answer52
viewsA: How do you make a slider menu in java?
Create each page in the same location, same name. NOTE: you need a server to run, just open the file with browser does not work. If you have php in the path, just use the cmd command "php -S…
-
0
votes1
answer37
viewsA: Column filter and average calculation
That should work data['price'][data.bathrooms == 2]. Mean()
pythonanswered Bernardo Lopes 892 -
1
votes3
answers73
viewsA: Doubt about storing the function result in a list and the types of stored variables
The function is not returning anything, has no return, puts the Return def VariacaoPercentual(a,b): print(((a/b)-1)*100) return ((a/b)-1)*100
-
1
votes2
answers29
viewsQ: Icone does not appear as desired using Fontawesome
I have a table with stock buttons but, as they are inside the tag the result is different than expected. OBS: I need you to direct to a new route. How to fix it. I want the result on the right side.…
-
0
votes1
answer122
viewsA: A function that takes the names of two files as arguments
This solves, I just added/rename some variaves, but the part of the code to generate the files are the same as the question lista= [] def countAluno(fAluno = 'aluno.txt'): with open(fAluno) as f: i…
-
0
votes1
answer112
viewsA: I need help with my Roman number code (C language)
The code problem is on these lines: if(s[i] > s[i+1]) if(s[i] < s[i+1]) You are comparing char, and this comparison is made by the value of the ASCII table. For example, X is worth 10 in Roman…
-
0
votes1
answer16
viewsA: authEmailPassButton is null
Puts the type nos Button <button class=" btn btn-lg btn-block btn-primary" id="authEmailPassButton" type="button">Autenticar</button>`
-
0
votes1
answer199
viewsA: Is that right? The question and doubt is in the commentary of the code
I believe this is the solution you are looking for. I put with log for better understanding. If all the text to appear on the screen is just start the variable i of for with 0 (i=0) <!DOCTYPE…
-
0
votes1
answer98
viewsA: Problems with Matrices - Python 3
The total sum is simple: somaTotal = 0 for i in range(len(matriz)): for j in range(len(matriz)): somaTotal += matriz[i][j] print('somaTotal: ',somaTotal) print('########################') For the…
-
1
votes3
answers124
viewsA: if and Else in Python
In the if structure only one of the blocks is executed, in the case if the first condition is true(if) then the if block will be executed. The Else block will only be executed if the first condition…
-
0
votes2
answers110
viewsA: Error listing table directly from Sqlite
the problem you are missing when creating the table and columns. You are placing the TABELA_PRODUTOS variable in quotes. Pay attention to table and column names, you need to uninstall and reinstall…
-
0
votes1
answer43
viewsA: check elements does not work
The method to insert value is always inserting at position 0. The method to check, checks more than once the same value. public void insertValor (int valor) { countValor ++; vetor [countValor-1] =…
javaanswered Bernardo Lopes 892