Posts by William Henrique • 589 points
23 posts
-
1
votes1
answer105
viewsA: How can I compare the data in the same column?
Well, from what I understand of your question, I’ve come up with something to try and help. However I did in PL/SQL using Oracle, in the case how you are using Postgresql sometimes you need to…
-
2
votes1
answer1015
viewsA: Select two tables with different columns in ORACLE
From what I understand, MATRICULA.nr_rgm references STUDENT.nr_rgm and MATRICULA.cd_class references CLASS.cd_class then to return all students of the same class who own the same NR_RGM and are…
-
1
votes1
answer1599
viewsQ: List manipulation with dictionary inside a Python loop
I have a list of lists, in which the internal lists contain words and each internal list represents the words of each different file. lista = [['carro','barco'],['moto','aviao'],['bike','skate']] ie…
-
1
votes1
answer1914
viewsQ: Passing a list of objects to a python dictionary
I have a list of objects: lista_objetos = ['acarreta', 'afeta', 'alavancagem', 'apropriadas', 'arvore', 'avaliacao'] each object stores information, among that information the word itself, Ex:…
-
4
votes2
answers1296
viewsA: Is it possible to add more than one item to a list at once?
With the method .append you will not be able to place a sequence of values inside a list. The correct method to perform the input of a sequence is the .extend, soon it will be like this: lista = []…
-
1
votes2
answers2397
viewsA: How to transform str into int?
If you want it to show 0 in the answer, you can do it this way: placar = "0 x 0" print(int(placar[0])) Output: 0 If you want to store each value in a variable: valor = int(placar[0]) valor2 =…
-
9
votes2
answers1673
viewsA: Error in program in Visualg
The problem is in the mode in which you are using the condition structure: se (condicao) entao <comandos> senao <comandos> fimse You always need to close the structure when you start it,…
-
1
votes1
answer128
viewsQ: Doubt in sql exercise query
I have the following relationships: The statement of the financial year is: The average grade given by teachers per course discipline Geography in the first half of 2013. Name teacher, discipline…
sqlasked William Henrique 589 -
3
votes2
answers1145
viewsA: Python object datetime value extraction.
First you need to use the following module from the following library: from datetime import datetime then just do: now = datetime.now() print("%s:%s:%s" %(now.hour,now.minute,now.second)) output:…
-
1
votes3
answers69
viewsA: How could I read a 3-digit value and print them on the screen reversed in C?
To invert the integer, just use the rest and division of the integer, like this: #include <stdio.h> #include <stdlib.h> int main(){ int numero, numIvertido; printf("Digite um numero…
-
2
votes2
answers52
viewsA: How to play a list that skips the numbers according to the number typed
If you want something that generates this result that you showed in the question, just do it: i = 0 lista=[] while i < 5: lista.append((i ** 2)) i += 1 Output: [0, 1, 4, 9, 16] and so on.…
python-3.xanswered William Henrique 589 -
13
votes3
answers1488
viewsQ: Using Lower() in a list of lists in Python
If I have such a list: Lista = [['DE','DO','OU'],['AE','YHH','OO'],['OW','LA','FOR']] and I want to leave her like this: Lista = [['de','do','ou'],['ae','yhh','oo'],['ow','la','for']] How do I do…
-
1
votes2
answers997
viewsQ: Manipulating lists in Python
I have a list like this: Lista_A = [['de','do','da','ou'],['ae','ay','yhh','oo'],['ow','pa','la','for']] How do I leave her like this: Lista_A_new =…
-
1
votes2
answers195
viewsQ: Find the problem in my Python object list
Well I’m asking this question, because I’ve tried several ways, but I can’t find the error in logic or the wrong use of some syntax in python. It would be as follows, I own this class: class…
-
2
votes2
answers4478
viewsQ: List of objects in Python
I’m doing a function that returns an object list. Snippet from the code: def guarda_word(lista_palavras,lista_objeto,indice): for i in lista_palavras: if bool(lista_objeto) == True: # a list de…
-
0
votes2
answers407
viewsA: How to correlate files from two txt files in Python
Well... I’d do it this way: First it would save the contents of each file in a list, using lista = file.read(), then make a newlista = lista.split() which would take each word and place it in a list…
pythonanswered William Henrique 589 -
4
votes1
answer85
viewsA: How to transfer an array of floats to an array of integers?
To convert float to int, just use the cast. would look like this: int main() { float grade[5] = {12.30, 15.55, 16.25, 0.00, 3.68}; int gradenew[5], i; for (i = 0; i < 5; i++){ gradenew[i] =…
canswered William Henrique 589 -
1
votes2
answers4032
viewsQ: Remove specific Python characters
My doubt is the following, in this excerpt of code I am removing a character that specifies with the replace(): lista = [["de carlos,"],["des.dd carlossd,"],["Peixe, texto!"]] lista_separados =…
-
3
votes3
answers8207
viewsQ: Separate each phrase word in an index from the python list
This code snippet generates me the following output. tamanho = len(lista_nome_base_docs) print (tamanho) lista_geral_de_lista_arquivos = [] for i in range(tamanho): with…
-
1
votes1
answer309
viewsQ: Return of python file read function
I did this snippet of code to read through a loop the contents of the list files. lista_nome_base_docs = ['a.txt', 'b.txt', 'c.txt'] tamanho = len(lista_nome_base_docs) print (tamanho)…
-
1
votes1
answer1939
viewsQ: How to open, read the file and save in a list of lists the contents of the file using Python
I have a list of paths txt files. With the read() function, I can save the entire contents of the file within a list where each word is stored at a list position. However as I intend to read 3 files…
-
3
votes1
answer1886
viewsQ: Remove whitespace from the Python list
I’m reading a file, stopwords.txt, and in this file each stopword is on a line, example: a o para Each stopword I am saving on a list as follows: with open(sys.argv[1],"r") as file_entrada:…
-
2
votes1
answer1958
viewsQ: Associate two lists in python
Associate two lists, a car name list and another color list and each containing n elements: listaCarros = ["gol","uno","corsa","palio","idea"] listaCores = ["branco","verde","preto","cinza","azul"]…