Posts by dfop02 • 123 points
24 posts
-
0
votes1
answer41
viewsQ: How to perform a has_many interaction query in Ruby on Rails
I’m having difficulty searching with has_many interactions in ruby on Rails. Goal is to search all vehicles that have no fines type 'guy'... The problem is that the query I made still returns…
-
-2
votes3
answers516
viewsA: Variation of while with scanf
It is a kind of redundant code, meaning that you are starting a loop while the program receives input from the user, that is, it will be an infinite loop unless you put a treatment for it. The…
-
0
votes1
answer42
viewsQ: Error adding items to a file. txt Python3
I’m trying to read a file . txt (currently empty) to check if chat_id already exists, if it already exists, it ends right there. If it doesn’t exist... Add the new chat_id in the last line, but when…
-
-2
votes1
answer148
viewsQ: Expect user response in Telegram - Python
How can I expect user response after executing a command? I am using Python 3.6 and the lib Telegram-bot-python. Example: usuario - /apel bot - Qual o seu apelido? usuario - dfop bot - Uau, seu…
-
0
votes1
answer149
viewsQ: How to checkbox validation in Ruby on Rails?
I’m studying ruby on Rails and little time, and one of the exercises I’m trying to do is a checkbox and a Submit button on a haml page, the goal is that the Submit button only works if the checkbox…
ruby-on-railsasked dfop02 123 -
-1
votes3
answers5610
viewsA: Function that checks whether a vector is in ascending order
Your code is semi-complete, it does exactly what it should do, the problem is the Return you put, so that it compares the first 2 numbers it finishes the function as true. The right thing would be…
-
0
votes0
answers45
viewsQ: Error due to update in Python
I am developing an install.py file that will serve as an alternative to install and create executable qq program in a simple and easy way. I’m having difficulty in the update function, I get to…
-
0
votes1
answer101
viewsQ: How to get the Gmail source code using Python3
I am accessing the Email using this code I found and adapted: import requests from bs4 import BeautifulSoup form_data = {'Email': '[email protected]', 'Passwd': 'senhaexemplo'} post =…
-
1
votes2
answers764
viewsA: Problem with Printing Repeated Numbers in C
There’s a logic error in your algorithm, when you go through this stretch for(i=0;i<N;i++){ for(j=i+1;j<N;j++){ if(Vetor[i]==Vetor[j]){ count++; aux[i]=Vetor[i]; } } } What happens is that…
-
0
votes1
answer68
viewsA: Python - Function with incorrect return
You are not calling the function correctly, try this way: def MontarURL(): URL = "C:\\Users\\tttt\\Desktop\\Imagens\\2.png" return (URL) # Você precisa chamar a função dessa forma, senão vai…
python-3.xanswered dfop02 123 -
1
votes3
answers85
viewsQ: Error searching string inside another python string
I’m running some tests and the code seems to be correct logically, but when I use an example, "what day is it today?" as self.phrase it only returns me the first if (of the hours), if I put as…
-
0
votes2
answers551
viewsA: string manipulation python
There are two suggestions for you to use, the first is to save straight to the file without the "," which would make things easier. If it is not possible, the second is to make a "copy" of each line…
-
-2
votes1
answer62
viewsQ: What are the differences between using a . txt and . bat file in python?
I am looking for practical and simple ways to save information in a separate file, that even after the closing of the program.py (in python) the information is not lost. And there was a question,…
-
-1
votes2
answers231
viewsA: read a txt file and list approved candidates
From what I understood from the txt document, I opened the file here, separated them by ";" and left everyone ready in a list. See if my attempt clarifies a little about how it can be done, because…
python-3.xanswered dfop02 123 -
1
votes0
answers113
viewsQ: Recursiveness - Why am I entering a loop?
I’m trying to implement an algorithm called Minimax, but I’m finding problems in effecting its recursion, it goes into a loop that I can’t identify why. The depth of the algorithm should vary…
-
1
votes0
answers91
viewsQ: Binaria tree with 3 pointers has special treatment?
I am setting up a hospital program and the order of the patients will be by a binary tree, taking into account a degree of urgency existing in the patient struct, as shown below. My question is: Do…
-
0
votes2
answers52
viewsA: How do I display the values of a matrix one to one in C? example: line 1: 1.2 line 2: 3.4 line 3: 5.6 " " " " " " " """
Try it this way: for(i=0; i<m_linhas; i++){ //Mostra a linha atual printf("\nlinha %d: ", i+1); for(j=0; j<n_colunas; j++){ //Mostra os elementos dessa linha printf("%d, ", matriz[i][j]); } }…
-
1
votes2
answers329
viewsA: Python: conditions for various symbols
I made a simple example, you cannot compare an entire list to a string, so to make it easier I used lambda function that will go through the list of symbols and check one by one if the special…
-
-1
votes1
answer46
viewsA: Status of sale in C#
There are several ways to do this check, for example, using 0 for unavailable and 1 for available, create a function that changes the status of this variable to the rental car from 0 to 1. Then just…
-
0
votes3
answers77
viewsA: Micro class system in C
Teste newTeste(){ Teste *t; t->soma = soma; return t; } Try this way, without the * in Return.
-
0
votes1
answer71
viewsA: Resolve Operation with Set
Create three integer type vectors of size 12: vector 0[12], vector 1[12] and vector 2[12]. int i, vet0 = 0, vet1 = 0, vet2 = 0; int vetor0[12], vetor1[12], vetor2[12]; for(i = 1; i <= 32; i++){…
-
0
votes1
answer242
viewsA: Doubt with Python neighbor numbers
The error is very simple, just use the raw_input() at the end of input(). Basically the input() it will receive and interpret as a list of integers, and when you try to use the input1.split(", ") it…
-
2
votes3
answers9117
viewsA: convert a string list into a list of integer numbers
Let’s go in parts, first convert all string values to integer, let’s go through the entire list for this. Converting one by one all list elements that are string, example: x = ['11', '14', '152',…
-
0
votes1
answer274
viewsQ: Problem creating Minimax in chess game
I am coding a chess game only in pure C. The game itself is ready, I am for some time trying to develop the algorithm of Minimax. Currently the algorithm is almost ready, but it is not returning and…