Posts by JeanExtreme002 • 5,663 points
331 posts
-
-1
votes1
answer258
viewsA: I need a recursive Python algorithm that multiplies two numbers through successive sums
First you need to create a function with two parameters (factor and multiplying). In the case how the function is recursive, I will name the parameters as x and times. Within this function you must…
pythonanswered JeanExtreme002 5,663 -
1
votes2
answers690
viewsA: Attributeerror: 'int' Object has no attribute 'value'
There are two errors in your code. The first error is that you are running the wrong method by calling incremento instead of incrementa. The second error is that you created the constructor with the…
-
2
votes3
answers203
viewsA: Should I always use Try catch to fix mistakes?
The best way to treat errors is to make sure there are no errors. The recommended is to use the block try-except only when you don’t have control of something that can possibly generate an exception…
-
1
votes0
answers57
viewsQ: What is the use of bitwise shift operators?
Recently I discovered the bitwise shift operators << and >>. I know these operators move bits left and right, but what’s the use of doing this ? In which cases these shift operators are…
-
1
votes1
answer186
viewsA: How to get the file name to be opened with my program by clicking on this file?
Good as now the question became a little clearer and specific, now you can already answer. As I said in the comments, to play a music file or any other file on Windows using your program, you will…
-
3
votes2
answers138
viewsA: How to be more cautious when using the Eval function?
Just as Maniero spoke in the comments of the question, an answer to how to be cautious when using the function eval would be too long. But now focusing on your task and assuming that you’re not…
-
0
votes3
answers36
viewsA: How to make the <p> tag divide a text into 4 lines of few characters?
To perform line breaking of an HTML text you must use the element <br/> at the end of each line. See the example below: <p> Olá Mundo!<br> Este é apenas um simples exemplo de…
htmlanswered JeanExtreme002 5,663 -
2
votes2
answers159
viewsA: Decoding a conversation
As well as the another answer says, you don’t need to turn your code into a list because strings are already indexed by position, acting as a list where each character will have its index. texto =…
-
0
votes1
answer108
viewsA: How to use for in Javascript to view photo gallery
The problem is that when you create the event of each element, the variable i inside the function is the same used inside the loop for. This means that at the end of the repetition structure, the…
-
2
votes1
answer91
viewsA: Progress bar only appears when the download ends
The problem is not the progress bar that crashes the program, but the download code. The graphical interface of tkinter always wheel in main thread and no more code can run on it from the moment you…
-
2
votes2
answers89
viewsA: recursive exchange
To create your recursive function, add an auxiliary parameter to the function signature to store the traversed indexes. def troca_recursiva(values, old, new, index = 0): Within a block try check if…
-
2
votes2
answers87
viewsA: How to define which inputs will be accepted by the code?
Just use a try-except to try to convert the string into a float. If the conversion is not possible, a ValueError and this will mean that the value entered was not numerical. See below how the code…
-
2
votes3
answers309
viewsA: What is the clipboardData.getData() method for?
According to the article on the MDN website, the method DataTransfer.getData() serves to obtain the pasted content in the clipboard. This means that in your code, this method will return the text…
javascriptanswered JeanExtreme002 5,663 -
0
votes1
answer255
viewsA: How do I navigate through a Python list for each function call?
There are many ways to do what you want and one of them is by creating an auxiliary variable to know the current index of the list, working as a pointer that marks where you left off in the list.…
-
1
votes2
answers684
viewsA: How to check if a directory is empty or if there is an existing file in the folder?
To check if a file exists in a directory, use the function fs.exists (deprecated) or else the function fs.existsSync. See the example below: const filename = "file.txt"; if (fs.existsSync(filename))…
-
1
votes2
answers436
viewsA: 1) Read a 10 x 10 matrix and write the location (row and column) of the highest value
The only thing you need to do is get the value position with the method index and then store it to a variable. See the example below where I create a tuple that stores the highest value and its…
-
1
votes1
answer39
viewsA: Dictionary within another
The method append does not exist in the class dict(). What you can do is use a key inside square brackets in the first dictionary and then assign the other dictionary to that key.…
python-3.xanswered JeanExtreme002 5,663 -
1
votes2
answers193
viewsA: Print characters to a given letter and include line breaks at the end
To perform line breaking, simply add a print() empty before getting user input or using the special character "\n" within the function input(). See the code below: letra = input() letra = ord(letra)…
pythonanswered JeanExtreme002 5,663 -
1
votes2
answers155
viewsA: How can I do this recursive function
What you should do is check within the function whether there is value or not in the list. If there is a value, the function returns the result of the same function by passing the same parameters.…
-
1
votes2
answers126
viewsA: How to operate on the counter of a while in each loop iteration
A simple mathematical calculation already solves the problem to find the result. Just divide the value by 100 and then multiply by contador that you get the result. resultado = valor / 100 *…
-
1
votes3
answers1126
viewsA: How to open window to select file after pressing the Submit button?
To perform a function when selecting a file, simply use the event onchange which will be executed only when the user changes the file name. To perform a request without the user pressing the button…
-
1
votes3
answers1126
viewsQ: How to open window to select file after pressing the Submit button?
I am creating an application and I need the customer to send in a <form> a file for the server. On my HTML page I have two buttons, download and upload, and I would like to have the client…
-
0
votes1
answer56
viewsQ: What "status code" to use when there is no data in the body of a POST request?
I am creating an application for the client to upload a file to the server and I would like to know what the Status Code ideal to return if in the request the file or any other important data is not…
http-statusasked JeanExtreme002 5,663 -
3
votes3
answers174
viewsA: Separates letters by javascript line
Just add the special character to the string \n in each character. Use the method split to separate and then use the method join to combine everything with this character. This way, each letter of…
-
1
votes1
answer94
viewsQ: Why still use String instead of Stringbuilder in Java?
As many of you may already know, creating StringBuilder can greatly save the performance of our Java applications, as they are much faster than a String. This is due to the fact that the…
-
4
votes2
answers114
viewsA: Error converting string to numeric value
The problem is that to turn a value into a float, decimal separator should always be a point instead of a comma. When you try to convert your string without treating it properly, the result is this:…
javascriptanswered JeanExtreme002 5,663 -
1
votes2
answers46
viewsA: Print an attribute of several classes
Just put all your objects inside a list and scroll through a repeat structure for, thus: expresso = Produtos("Café", "Expresso", 4.9) cf_com_leite_medio = Produtos("Café", "Café com leite Médio",…
-
2
votes4
answers1041
viewsA: Doubt Exercise Python
The problem with your code is that you set the last line to 1 for the variable coluna. This way, your program will print a character "#" unless. To fix the problem, just change the value 1 to zero.…
pythonanswered JeanExtreme002 5,663 -
-1
votes2
answers54
viewsA: Loop to find correct combination
To perform multiple requests by changing the value of number between X and Y, just scroll through the numbers inside a loop for using the function range (returns numbers between X and Y) and then…
-
1
votes1
answer67
viewsA: How to create conditions in read and write text files (python3)?
To make the program "skip" a line when finding the "<br>" in the text, just use the string method replace to replace this element with the special character "\n". See the example below: file =…
-
1
votes1
answer200
viewsQ: How to pause or play the animation of a GIF in Javascript?
I am creating an HTML page that has an image format gif and a music display just below it. <div><img src="imagem.gif"/></div> <audio> <source src="musica.mp3"…
-
5
votes2
answers1699
viewsQ: How to compare each character of a Java String?
I’m creating a Java application where I travel through one String with a bow for and I need to check every character of that String. Example: for (int i = 0; i < texto.length(); i++) { char…
-
0
votes1
answer250
viewsQ: How to limit the size of an element with padding in CSS?
I want to create an HTML page with a <div> which has a fixed height of 450px to save text and other elements. To do this, I created a class with the following CSS properties. .minhaClasse{…
-
2
votes4
answers2686
viewsA: Create multiple lists containing random numbers
It’s quite simple, just create the main list (the one that will store the fifty lists) and then create a sub-list to store the 12 random numbers. Inside of one another for...range you should add the…
-
0
votes1
answer138
viewsQ: How to open an HTML document from fetch in the same tab?
I’m creating a riddle site in which each riddle, the user must insert an answer on prompt and this reply will be sent to the server by POST request with the function fetch. On the server side, the…
-
1
votes1
answer186
viewsQ: How can I inject a standard script into my HTML files using Node.js?
I am creating a server with Express in Node.js where each HTML page is different but has the same Javascript code on <head> of the document. What I want to do is write this Javascript code…
-
1
votes7
answers1969
viewsA: How to remove repeated numbers from a python list
Your function is sorting the list and removing the repeated numbers perfectly. What you need to do now is just use the return to return the new list. def remove_repetidos(list_): return…
-
0
votes0
answers667
viewsQ: Why does the attribute "autoplay" not start audio?
I am creating a page where I need to play a sound automatically as background in an infinite loop. The problem is that even using the attribute autoplay, audio does not start. See below my code:…
-
0
votes2
answers26
viewsA: How to return a set of elements as a single string?
If your problem is not knowing how to add the quotes, just put them at the beginning of the first impression and on end of the second impression, thus: if len(b) == 10: print('"(', end = '') #…
-
0
votes1
answer37
viewsA: How to add elements from a file to a dictionary?
Just scroll through each line of your file and separate each item from the line by the comma with the string method called split. In doing so, you can create a key using the first item in the list,…
pythonanswered JeanExtreme002 5,663 -
1
votes1
answer43
viewsA: Can I get some help? Basic Javascript: Testing Objects for Properties
What the exercise of this website asks is only to create a function called checkObj that receives two parameters (objeto and propriedade) and returns the value of the property if it exists. If the…
javascriptanswered JeanExtreme002 5,663 -
1
votes1
answer55
viewsA: I need help with this code
The problem is that the Python language differentiates upper case letters from lower case letters, so the string "Denise" is different from "denise" and surely you are writing the other names with…
-
1
votes1
answer326
viewsA: How to remove the dot after the number in the marker?
To remove the point after item numbering is a somewhat complicated process but it is possible to do so. Use the CSS code below, this will take the point of the number the way you want it: ol {…
htmlanswered JeanExtreme002 5,663 -
0
votes1
answer105
viewsA: automatic matrix with python rule
To generate this two-column matrix is very simple, just use a loop for to go through each percentage obtained and thus, perform its calculation adding to the matrix a list containing the value…
-
1
votes2
answers806
viewsA: How to use cv2.imread() with an image type object instead of "image path"?
I didn’t quite understand the purpose, but if you want to simply save the image to use it again with Opencv, you can use the method save() of the image in this way: pil_image =…
-
0
votes2
answers183
viewsA: How to resolve "There is no default constructor in ..." error in Java?
After breaking my head a lot and researching a lot, I discovered that the error was caused by the class builder Veiculo was implicitly called, without passing the parameter. If my constructor does…
-
2
votes2
answers183
viewsQ: How to resolve "There is no default constructor in ..." error in Java?
I have an abstract class called Veiculo which has two builders: public abstract class Veiculo { // Atributos ... public Veiculo(Marcas marca, int velocidade){...} public Veiculo(Marcas marca, int…
-
1
votes2
answers1820
viewsA: How to change the color of a row in the HTML table in Javascript
First of all, in your code you scroll through all the rows but don’t scroll through all the columns, instead you just check the index column 1. Soon, you could never find the value 19 which is in…
javascriptanswered JeanExtreme002 5,663 -
3
votes2
answers5692
viewsA: How to print all the contents of a list in Python
To print all posts, just scroll through all the elements with a loop for, and you should use a range to print the contents. To leave all posts on a single line, set a string with space (" ") as…
-
1
votes3
answers138
viewsA: The why of using break
The statement break serves to interrupt the execution of a repeat loop (while and for), no more code below it being executed that is within the repeat structure. See below for an example: for numero…