Posts by JeanExtreme002 • 5,663 points
331 posts
-
5
votes1
answer1797
viewsA: How to use the if block with variable types in Python?
To do this check, you can use the function type passing its variable as argument ID. What this function does is simply return the class to which the object belongs. So you can check whether or not…
-
2
votes4
answers138
viewsA: Count inside an array with values from another array
The problem is that in doing for valores in array1: you are going through the values of this list, passing to the variable valores a string. To get the desired output, do so as follows: array1 = […
pythonanswered JeanExtreme002 5,663 -
3
votes2
answers242
viewsA: Problems with python code
You forgot to put the parameter self in the signature of the method select_image.
-
1
votes1
answer794
viewsA: Find element input inside the Python matrix
The problem is that you are trying to access the number through the list of lists. For it to work, you must access the number in the lists that are inside the list i. Implement this: for w in x: k =…
pythonanswered JeanExtreme002 5,663 -
0
votes0
answers217
viewsQ: How to make a socket connection using Hamachi in Python?
I’m trying to connect with socket on another network with Hamachi. When creating the server, I am using the local IP and when connecting I am using the Hamachi IP. See my code below: # Código do…
-
0
votes1
answer117
viewsA: Display Qtd of read numbers, medium, larger and lower read value
It’s something like this you want ? import os numbers = [] while True: os.system("cls") # Esse comando só serve para limpar a tela, então ignore caso você ainda não conheça sobre o módulo "os" num =…
-
0
votes1
answer106
viewsA: How to set a timeout for the Python recv() method?
To solve the problem, I just needed to put the recv within a block try and if any errors were made, I would only use the break to leave the block. That way: while not self.__stop: try: data =…
-
0
votes1
answer106
viewsQ: How to set a timeout for the Python recv() method?
I’m creating a program in Python using socket, and I came across a bug in the program that occurs because the recv does not inform if the connection has been terminated or not. Someone there can…
-
-1
votes1
answer397
viewsQ: How do I connect to another network with a socket?
I have created some programs like a multiplayer ping pong game, chat and others, using socket. They all work perfectly and I can connect to other devices that are connected on the same network as…
-
0
votes2
answers288
viewsA: Print repeated strings inside the List in Python
You can go through the list elements and get the index of each one with for loop. Example: chute = "a" palavra = "bicicleta" positions = [] i = 0 # Como strings também são sequências, não é…
pythonanswered JeanExtreme002 5,663 -
1
votes1
answer761
viewsA: Python module import Import ('cannot import name rr',))
The problem is on the line from recebimento import run,rr of the archive enviar.py. You are trying to import from the module the function rr that is within another function. That is why this error…
-
0
votes2
answers327
viewsA: Delete Root Directory in Python
In order to be able to delete the directory, you must first delete the files and folders inside it. Use the function walk to go through all files and subfolders of the root directory and delete them…
-
0
votes1
answer904
viewsA: Python3 Tkinter method Stroy
As the name says, the method destroy serves to destroy the created widget. If you use the method in a Label, only this object will be destroyed. If you use the method in a Frame containing two…
-
2
votes2
answers50
viewsA: Return filtered values in Shell Bash for insertion in BD
Why don’t you use the library psutil ? It is very simple and can be used on Windows, Linux, etc. For what you want, create an object of Process and then get the process name and CPU usage in…
-
-2
votes1
answer1094
viewsQ: What is Batch Script?
I started studying about Batch and a question arose in my head about whether or not he was one programming language. I did a search on the internet on this subject and some people say no, others say…
-
0
votes3
answers174
viewsA: Condition "If" does not enter the structure
If the value received from bi['Localizador [Outros, Aéreo, Cruise]'] for a string, so it will not enter the if because you set for it the condition of if the string is equal to ",". The right thing…
-
0
votes1
answer177
viewsA: Function to print directory on a Python Label
To insert a text into Label use the method config and pass the directory obtained as argument for the parameter text. The Label object also works as a dictionary, so you can also set the key text of…
-
1
votes1
answer44
viewsA: Unintentionally changing the value of the object
Probably ( I say probably because I don’t understand very well how your game works ) the problem is that you have used -= instead of a subtraction operator -. The result of this is that you will…
-
1
votes1
answer353
viewsA: Summing numeric values in text files with Python
Yes, you can use open to open a file in read format, get the value, add it inside the program and then write the file again with the updated value. Example: def atualizaGastos(valor): with…
-
2
votes1
answer90
viewsA: Exercise - Calculation of bhaskará
The problem is that on the line of r1 and of r2 you didn’t close the parentheses of float. See below: Original: r1=float((-b +(delta ** (1/2))/2) r2=float((-b -(delta ** (1/2))/2) Modified:…
-
1
votes2
answers835
viewsA: Python Spent Fuel Exercise
It’s very simple. The function input returns at all times a string, regardless of whether the user typed only numbers. In Python it is not possible to perform arithmetic operations with strings (…
-
1
votes1
answer503
viewsA: create dictionary based on two lists
I don’t quite understand what those "X" and "Y" values mean, but it would be something like this that you want ? import json items_list = ["frango a passarinho","pizza de calabresa"] id_item_list =…
python-3.xanswered JeanExtreme002 5,663 -
0
votes2
answers9963
viewsA: Invert the words of a sentence, keeping their order in the sentence
Use the method split to separate each word from the string and then invert it. Example: new_string = "" frase = input('Digite uma frase: ') #A função input retorna sempre uma string print(' Você…
-
0
votes1
answer228
viewsA: I cannot install pyautogui in python 3.7
The version 3.7 of Python is still very recent and some tools, libraries and others do not have support for it. I discovered on the internet that this version will be 100% in early 2020. For now try…
pyautoguianswered JeanExtreme002 5,663 -
2
votes2
answers4031
viewsA: What is Workspace in Visual Studio Code
The workspace is basically a project with one or more root folders where you can store everything related to the project (settings, extensions, etc). This option Save Workspace As... will generate a…
-
0
votes2
answers136
viewsA: How to do continuous firing in python?
There is a very simple way to solve this problem. Use the function of cv2 calling for waitKey(delay). What it does is basically wait for a time in milliseconds for the user to press a key. What it…
-
0
votes1
answer531
viewsA: How to make this program repeat itself?
Use the repeat block while. The block’s syntax is while bool:, where, it will repeat the code while the condition is True. Soon your program can stay that way: stop = False while not stop:…
-
0
votes1
answer1879
viewsA: How to use Pyinstaller in Python 3?
If what you want is to generate one .exe packaging these directories into the program, you can use the command --paths=<diretório>. What this command will do is simply "add" the directory…
-
0
votes2
answers4974
viewsA: Print larger number of an array
Just do a check using the for as follows: int valorMaximo = grade[0]; for(int number:grade){ if (valorMaximo < number){ valorMaximo = number; } } To check which index is the highest number just…
javaanswered JeanExtreme002 5,663 -
0
votes2
answers1348
viewsA: error while doing git push
welcome to Stackoverflow. I believe your problem is in relation to the branch name local different from the branch name remoto. If this is the problem, the error is being generated because you are…
-
2
votes3
answers2034
viewsA: Handle cmd files using python
Welcome to Stackoverflow ( although I am beginner here also kkk ). For language Python, there are two modules that can help you, called os and subprocess. import os command = "<insira o…