Posts by JeanExtreme002 • 5,663 points
331 posts
-
4
votes1
answer309
viewsA: Traverse array with Indice string
From what I can see, the feedback you speak of being an Array is actually an object. The structure of an Array and an object are quite different as you see in this example below: myArray =…
-
1
votes1
answer59
viewsA: Doubt about the replace() method
As you said yourself, replace is a string and value method of the type int or float nay possess him. What happens in your code is that you pass the value into a new string using string formatting…
-
0
votes1
answer183
viewsA: How to take the data of an input text and put in a variable?
To get the text of a <input> you must access the attribute value element. See the example below: function hello(){ name = document.getElementById("inputName").value;…
-
0
votes1
answer41
viewsA: How to check if a file exists by numbering
The problem with your code is that you don’t repeat the check to find an X file that doesn’t exist in the directory. Inside your function verifica() for example, you increment the variable x if the…
python-3.xanswered JeanExtreme002 5,663 -
0
votes1
answer717
viewsA: Exercise python read Dat file
You can use in each row the method split() to obtain separate grades and then check which students have more than six grades by getting the size of the list from index 1 to the end. See below how it…
pythonanswered JeanExtreme002 5,663 -
1
votes1
answer104
viewsA: How to capture each key pressed in an entry with Tkinter?
You just need to create an event using Entry.bind() called "<Any-KeyPress>" passing the function you want to call. That way, whenever the user presses any key, having Entry focus, the function…
-
6
votes1
answer973
viewsA: Could you create a function to decrease the number of if’s in the program?
Yes it is possible, but first, I’d like to talk about some quick improvements you can make to your code. First of all, it is not necessary to use parentheses when creating the string and calculating…
-
3
votes3
answers204
viewsA: Is it possible to save a used browser object localstorage?
Answering your first question, yes it is possible to save values using localStorage after reloading the page. Actually, all the data saved on localStorage are stored on your computer, even if you…
-
1
votes1
answer161
viewsA: How to pass the value of a variable to another HTML document in Javascript?
Yes is possible. You can pass several values in the URL of your other html document using the tabs ? or #. If you choose to use #, you must get the values in the other document by location.hash and…
javascriptanswered JeanExtreme002 5,663 -
6
votes1
answer197
viewsQ: What is a Pentester?
Browsing the internet, I saw some hackers talking that they work or worked as Pentesters and I would like to understand more about this profession. There is some difference between Pentester, Hacker…
-
0
votes1
answer103
viewsA: Change in button text with Kivy language
You would need an auxiliary variable with a boolean value to switch between on and off. See this example below: class MyButton(Button): __status = False def change(self): self.__status = not…
-
0
votes2
answers161
viewsA: Complete the URL
This problem is happening because in the function signature you did not declare a parameter name to be passed a value but a String. To solve this problem change this String by a name quote-free,…
-
2
votes1
answer247
viewsA: How to sum the values of each element of 2 lists with List Comprehension
You can create a Comprehension List by getting the size of one of the lists to insert into one for..range and then return the sum of the position element i of the lists a and b. See the code below:…
python-3.xanswered JeanExtreme002 5,663 -
0
votes2
answers300
viewsA: Doubt in PA code in Python
For the code to work it is not necessary to create and assign a new variable called termo the value of pri_termo, but he did it so that the value of the first term was not changed. You see, if…
pythonanswered JeanExtreme002 5,663 -
0
votes1
answer33
viewsA: How to register values in a two-dimensional array?
In Java the size of the arrays are fixed, that is, once you create the X-size array you cannot add more elements to it. So when you create an array {{},{},{},{},{}} you say they will all have size…
javaanswered JeanExtreme002 5,663 -
1
votes1
answer141
viewsA: Use Python to import locally saved htm file information
There are many ways to extract information from HTM files but I think it is easier using the library Beautifulsoup that is proper for this. Below is the code that I made. from bs4 import…
python-3.xanswered JeanExtreme002 5,663 -
0
votes2
answers69
viewsA: Iterations in a tuple list
First of all you should know that when you create a list or any other object, you do not assign to the variable the object itself but rather a memory address of the object that is stored inside your…
-
0
votes2
answers230
viewsQ: What is the size_hint_x attribute in Kivy for?
During my studies in the Kivy framework, I discovered two attributes of the object BoxLayout called size_hint_xand size_hint_y that by what they say, they fit the size of a widget to the size of the…
-
0
votes2
answers1775
viewsA: By clicking the scroll down button to the end of the div
To scroll the page you can use the methods scrollBy() and scrollIntoView(). The scrollBy(x, y) is a method that takes as parameter the position X and Y from where you want to scroll the page. So,…
-
1
votes3
answers115
viewsA: Conditional structure if Else are not working
I can’t understand exactly what you wanted to do within the function pegaDtInicial, but to check within a if the function getRadioSelected1 you are not checking a value but whether it has a…
javascriptanswered JeanExtreme002 5,663 -
5
votes3
answers4009
viewsA: How does the python sys module work and what is it for?
The module sys provides functions and variables used to manipulate different parts of the Python runtime environment and although they are completely different, many people confuse the module sys…
python-3.xanswered JeanExtreme002 5,663 -
7
votes3
answers603
viewsA: Why is it allowed to delete elements from an array defined as const?
Its array and the objects contained in it have no connection. The array is just an object, or rather, a memory address that holds other objects inside it. The definition const serves so that the…
-
1
votes2
answers548
viewsQ: How to convert the hash() value of a string back to the original string?
I’m learning now about Hashing and discovered that Python has a function called hash() that returns the hash value of an object. The problem is, how can I convert this value to my original object,…
-
0
votes0
answers67
viewsQ: Border in CSS is changing the output of getBoundingClientRect()
I’m creating a Snake Game in Javascript and to perform animations, collision detection and others, I use the function getBoundingClientRect(), to get the position left and top of a game element. I…
-
0
votes1
answer175
viewsQ: Why is the expected " SCRIPT1004: ';' error" generated when running the application in Internet Explorer?
I recently created a Javascript application that works perfectly in the browser Chrome and yesterday I decided to test it on Internet Explorer. To my surprise, the page was not the way it should be…
-
2
votes1
answer334
viewsA: How to do a file search using Python
I’m not an expert at creating recursive functions but I did my best to answer your question. It is possible to make by hand a function like the walk through recursiveness only that I still needed to…
-
1
votes2
answers250
viewsA: Referencing Python Variables
First of all, you should know that the variable Resposta and the variable X in your function are different. First because the nomenclature is different, then if you want to change the variable…
-
1
votes1
answer333
viewsQ: Is it possible to run a Javascript code after page forwarding?
I finished an online Javascript course and decided to create a simple program that allows me to open the page Google with the background of <body> in black. My idea was to perform a redirect…
-
1
votes2
answers59
viewsA: I am clicking on the <Details> or <Summary> element?
You are clicking on <summary> 'cause just like you said, he’s in front of the <details>. To confirm this, I changed the code so that when clicking somewhere on the page, it informed the…
htmlanswered JeanExtreme002 5,663 -
3
votes2
answers105
viewsA: Does Python syntax accept either "+" or "," in the "print()" command?
These two ways of printing a string work perfectly and have no differences in the final result, but the process is different. In the first case, you are concatenating the string "Olá " with the…
python-3.xanswered JeanExtreme002 5,663 -
1
votes1
answer961
viewsA: Storing Variable in a Python TXT File
Use the function open() passing as parameter the file name and the opening mode, which will be in this case "w" to carry out writing in this way: file = open("arquivo.txt","w") After that, save the…
-
1
votes1
answer3100
viewsA: How to check if part of a string is contained in a Python list?
Just you check with the operator in if the strings inside the list then inside its text, traversing the list with a for loop and using the method lower() so that there are no differences between…
python-3.xanswered JeanExtreme002 5,663 -
0
votes0
answers125
viewsQ: How to get all files used on a page using "requests"?
As we know, when accessing a website by browser, various files such as images, music, scripts, CSS, among others, are downloaded to be used within a page HTML. Using the library requests, it is…
-
4
votes1
answer74
viewsA: How do I build attributes based on values defined in the __init__ method in my class?
First of all, this error there occurs because during the definition of your class, there is still no object, so there is no self. And for this reason, it is not possible for you to check whether you…
-
1
votes1
answer112
viewsA: A program that every time it is called updates the time and return
The return of your function is always the same because you do not update the hora and doesn’t even test the connection again, you’re just printing multiple and multiple times the call result of a…
-
-2
votes1
answer2475
viewsQ: Where is the data stored in Mysql 8?
Two days ago I started studying about the Mysql and so far I only know his basics, not to mention that he’s the first SBGD what study. One very interesting thing about Mysql that I found, is that…
-
2
votes2
answers57
viewsA: Input resulting in None
This happens because its function does not have a return and Python automatically returns None when calling the function. Fixing the problem: You want to write your code so that the user can type on…
pythonanswered JeanExtreme002 5,663 -
2
votes1
answer1227
viewsA: PYTHON: Nameerror: name "..." is not defined, but I defined the function
This error is being generated because in fact there is no function called move_up. What you want to call is a method of an object, so you must pass the instance self by calling the function, thus: #…
-
2
votes1
answer694
viewsA: Splitting codes into . py files
Using the "import": You must import the modules using the import. There are several ways to import a module, see below: import module # Importa o módulo com todos os seus dados import module as…
pythonanswered JeanExtreme002 5,663 -
2
votes1
answer64
viewsA: Why doesn’t the program recognize the "N"?
The error is being generated because you did not initialize the variables N and divisor in its class or out before being used to define the parameter prova_cabal = N % divisor. I don’t know what…
-
3
votes2
answers75
viewsA: Counting the number of executed operations over the same input for a recursive call
This error is being generated on the line where you try the code cont += 1, because nowhere in the code did you initialize this variable. Corrected code: cont = 0 def power(base,expoente): global…
-
1
votes1
answer49
viewsQ: How do I use the "define_method" correctly in Ruby?
I was researching on the internet how to create methods dynamically in Ruby and in some forums in English, people spoke to use the method define_method, passing a name to the method and a &block…
-
1
votes1
answer572
viewsA: What’s the difference between "include" and "extend" in Ruby?
The difference is that the include injects the methods of a module into a class or another module such as instance methods. Already the extend, injects them as class methods. Still having doubts…
-
3
votes3
answers67
viewsA: How to not execute lines of code when the name is not in the list
Tip to improve the code: ( Operator "in" ) First of all, you can check if the name is on the guest list using the operator in, there is no need to check item by item with the for loop. Example:…
-
1
votes1
answer572
viewsQ: What’s the difference between "include" and "extend" in Ruby?
I’m studying Ruby, and I’ve come to realize that there are two ways (maybe there are more) of injecting methods into a class. At first I thought they might be the same things, since Ruby is a…
-
3
votes1
answer815
viewsA: How to handle a windows window in python?
You can use the library pygetwindow. To install it, just type: Pip install Pygetwindow For starters, import pygetwindow and then get the window using the function getWindowsWithTitle(title). There…
pythonanswered JeanExtreme002 5,663 -
16
votes1
answer3610
viewsQ: What exactly is the backslash ( ) for in Python?
I sent an application to Github written in Python that was updated by someone who claimed to have formatted the code properly. After starting to see the changes, I got scared thinking that it had…
-
3
votes1
answer198
viewsQ: Method "include?" returning false when there is a character in the Ruby string
I’m a beginner in Ruby and I’m trying to create a Hangman game to test my language skills. In a part of the code, I need to get a letter chosen by the user and check if that letter is present in the…
-
0
votes1
answer92
viewsQ: How exactly does "private" and "protected" work in Ruby?
I’m studying Ruby and arrived at the access control part. I had studied before access control in Java, then I thought it would be the same, but to my surprise, the statement private and protected…
-
1
votes2
answers98
viewsA: What is the difference between a string defined within a text file and another defined as a variable?
The string defined in the variable and the one coming from the text has no difference. What the function open() returns is an object of<class '_io.TextIOWrapper'>, where you can get the file…