Most voted "code-review" questions
DO NOT USE this tag for non-functional code, with bugs or problems. Just use this tag by providing already functional codes and a clear explanation of what the code does, so that the community can post improvements and optimizations (without changing its essential functionality).
Learn more…74 questions
Sort by count of
-
0
votes1
answer40
viewsImprove javascript menu logo code
How can I improve this code? Throughout scroll He does this check and puts one on top of the other. It’s functional, but I find it very heavy and with many requests. Any hint as to how I can improve…
-
0
votes3
answers112
viewsHow to simplify the process of verifying a certain value?
For example, when I need to check some certain values, I create a "method", similar to that: public function verificaString($campo) { if (isset($_POST[$campo]) && (!empty($_POST[$campo])…
-
0
votes1
answer65
viewsHow to transform this code to validate multiple files?
The code below is found in PHP documentation, allows you to upload files, only it only allows one file per upload. How to transform this code to validate multiple files? <?php…
-
0
votes1
answer44
viewsTips for making a cleaner code
Starting in java programming and would like to know how to make code cleaner, this is an example of a recent code I created public void chamarButton(JTextField login, JTextField senha){ String pass…
-
0
votes0
answers28
viewsRecursive List with depth count
I created a code to organize a recursive list of categories to print as follows: category 1 -- category 1.1 category 2 -- category 2.2 --- category 2.2.1 json file of data : const data = {…
-
0
votes1
answer131
viewsPython Kick Game. Does anyone have any hints how to reduce or improve this code without using functions?
from random import randint from time import sleep valor = randint(1, 20) tentativa = 0 chute = 0 print() while chute != valor: chute = int(input('\nChute um número:…
-
0
votes1
answer68
viewsCan I do better code than this in Python? I’m a beginner in the language and would like to know if I’m on the right track
Objective of this program is to receive the radius of the user and calculate the area of the circle. I’m a beginner in Pyhton, so I’d like to know if this is the most efficient code I could do to…
-
0
votes1
answer38
viewsHow to improve a calculator
I wonder if we can make this code not stop when I type a letter instead of a number, just correcting and telling to type a number. namespace calculadora { class Program { static void Main() {…
-
-1
votes1
answer732
viewsHow to remove a user due to inactivity?
I wanted to know how to remove a user when it becomes inactive on the page, for example in Phpmyadmin, which removes the user after 24 minutes of inactivity? If the first part is too difficult to…
-
-1
votes1
answer244
viewsCode Review: Program that simulates the "door game": either you win a car or a goat!
Write a program to simulate the door game. Make a program that has the output as the following: Hello, welcome to our program! Let’s see if you will win a car or not! Choose one door: 3 You chose…
-
-1
votes2
answers991
viewsTransform matrix into vector
I am doing some exercises with matrix and array, and I arrived at the following situation: static void Main(string[] args) { int linha = 3; int coluna = 3; int[,] matriz = new int[linha, coluna];…
-
-1
votes3
answers79
viewsGreatest prime number
Could you help me with my code? I am trying to get the program to print the largest prime number the user has typed, but my program is printing the largest of ALL and not the largest prime. here is…
-
-1
votes1
answer140
viewsConditional if more cleancode
My intention is to decrease the size of the condition, because I thought that it became extensive making it a little difficult to read, and that maybe there could be a better way to do this: by…
-
-2
votes2
answers94
viewsProgram to remove ONLY a copy of duplicate values from a list
Write a method rem() that accepts as input a list possibly containing duplicate values, and return a copy of the list where a copy of each duplicate value is removed. What I did: def rem(lista): i =…
-
-2
votes0
answers21
viewsEncode filenames in Base64 in python?
I need help from you to implement a python code to encode the filenames in Base64 and name it right away and then code and then decode back the filenames of those files. import os import base64…
-
-2
votes2
answers116
viewsIs there any way to simplify this amount of conditions?
I have the following code: foreach (var lote in collection.ToList()) { count++; ushort[] dadosBalanca = new ushort[9]; if (lote.AlvoPasso > ushort.MaxValue) { var subtracao = (lote.AlvoPasso -…
-
-2
votes1
answer73
viewsRounded up the values obtained
Good afternoon, I am preparing, where the matrix is formed by the following code: var valores4=''; for(var LL =0;LL < noc*nol;LL++){ for(var CC =0;CC < nol*noc;CC++){ if(CC < noc*nol-1){…
-
-2
votes2
answers100
viewsWhat is wrong with python below? Any suggestions for another solution?
Problem: Having a 5 5 matrix filled with random (real) values between 0 and 99, show which is the second highest value existing in the matrix. Can’t use numpy or similar. My solution: n=2 def…
-
-2
votes1
answer59
viewsCan you improve my code?
Hi, I’m Vitor, and I’m new to programming and Stack Overflow, and I’d like some tips on how to clean my code. ->Code to read 50 integers between 0 and 9 and count how many times each number was…
-
-2
votes1
answer72
viewsHow can I improve/simplify my structure?
We have these various ifs and I wonder if there’s a way to simplify them, make them more objective, easy to understand, ... Basically, we make a where of retorno to filter that list. In that where,…
-
-3
votes2
answers72
viewsWhat’s wrong with this PHP code?
if(count($items) > 1) { $out = array('success'=>false,'error'=>'You choose more bots'); } elseif($user['balance'] < $sum) { $out = array('success'=>false,'error'=>'You dont have…
-
-3
votes2
answers95
viewsHow to store value in a variable and return its primitive type and other information
I need to make a program that reads something on the keyboard and shows on the screen its primitive type and all possible information about it. I’m still developing the code. But I’ve already…
-
-3
votes2
answers86
viewsHow can I simplify these two functions?
This code sums the columns and rows of a matrix separately. I created these two functions to do this and I need to simplify my code by transforming them into one. Note that the only thing that…
-
-5
votes2
answers37
viewsWhat is the syntax error in my function?
def Grow_population_rate(year_1, year_2, City_name, pop_1, pop_2): pop_diff = pop_2 - pop_1 year_diff = year_2 - year_1 for pop_rate = pop_diff/year_diff * 100: return("The…