Posts by absentia • 457 points
19 posts
-
1
votes2
answers501
viewsA: Create array/list with indexes
Python does not offer type array as primitive type. You can work with listas, for example, that have indexes starting in 0. Another option, is you use modules: there is the module array of python…
-
1
votes2
answers171
viewsA: os.path modulo python
This code uses the concept of list comprehension. List comprehension is a syntactic sugar of the python language that follows the following notation: [expressão for item in list if condição] What he…
-
4
votes2
answers60
viewsA: I cannot add "variable = variable + 1" to the while loop
When you open a file with open() it returns an object of the type file object. From it you can write in the file doing meu_arquivo.write(conteudo) where content should be a string. So, if your data…
-
1
votes1
answer48
viewsA: I don’t understand why it doesn’t show all the cousins in this range
Missed you to initialize cont=0 in function eh_primo int eh_primo(int x){ int i; int cont =0 ; for (i=1;i<=x;i++){ if (x % i == 0){ cont +=1; } } if (cont == 2 || cont == 1){ return 1; }else{…
-
2
votes1
answer652
viewsA: Python - Tabuada- For Exercise - Matrix
When filling the matrix, you can put in the list linha not only the value, but the information you want: linha.append('{} x {} = {}'.format(i, j, valor)) Take a look to learn more about string…
-
1
votes2
answers725
viewsA: Inserting images into a Tkinter frame
The problem is related to the way Tkinter/Tk manipulates images. Tk keeps a reference for images, while Tkinter does not. When the python Garbage Collector clears the Tkinter object, Tk keeps a…
-
0
votes1
answer132
viewsQ: Tkinter Entry always captures empty string
I am trying to create an application with graphical interface using the Tkinter. The graphical interface consists of a button, one text and of a entry, as in the image below. The idea is to type a…
-
-1
votes2
answers725
viewsQ: Inserting images into a Tkinter frame
I’m trying to add an image inside a Frame using the Tkinter through the code below: class Gui(): """ Implements a GUI for Interactive Dictionary app """ def __init__(self, parent): self.parent =…
-
1
votes1
answer427
viewsQ: Access path space environment variables
I created an environment variable that stores a path roomy: /c/Users/Bruno Xavier Despite being in windows, my intention is to use it by git bash for easy access to the directory. I tried the two…
-
2
votes0
answers365
viewsQ: diff a file into a specific commit and HEAD
How can I compare the difference to HEAD and the last commit that contains a specific file? To find the last commit that contains the file read the information at git diff file Against its last…
-
3
votes1
answer1155
viewsQ: Import python C++ modules
I’m trying to import into one script python a module C++: import hector_path_follower The archive c++ defines a namespace for the class: namespace pose_follower { class HectorPathFollower { ... } }…
-
1
votes1
answer3068
views -
0
votes1
answer52
viewsA: Error accessing Dictionary Code
The archive .csvwas generated incorrectly. Using ; as a separator or actually generates a single index Longitude;Latitude. The right color is to use , as a separator in the input file. This way two…
-
0
votes1
answer52
viewsQ: Error accessing Dictionary Code
I create a program to read from a file csv a set of coordinates and stores them in an object DataFrame. The code goes below df = pandas.read_csv(os.getcwd() + "/Coordinates.csv")…
-
0
votes0
answers486
viewsQ: Open files through the relative directory
How do I read the relative file path that is in a different python file directory and then open that file? For example: For archive1 in the name_project/files/file1.txt directory and the python code…
-
2
votes1
answer464
viewsQ: Partial sum of elements of a vector in O(n) or O(log n)
I have an A vector of size n. I have to calculate the partial sum of each element and write in the matrix B[i,j]. Pseudo-code shows a solution O(n 2); For i = 1, 2, . . . , n For j = i + 1, i + 2, .…
-
6
votes1
answer391
viewsQ: Display of Latin characters in a String
How do I display Latin characters as content from a web page? This content to be displayed is written in java, which should code it correctly and return a Stringwith the values to be written to the…
-
1
votes0
answers319
viewsQ: Geocoding using Google Maps and jQuery
I created a bar for the user to enter the desired destination location. This address is captured through the function click() of jQuery. At this point the code is working, but for some reason, the…
-
1
votes2
answers589
viewsQ: Image changes alignment of all components within a div
I’m creating a FORM within a DIV. In it I have a text box for the user to enter the data and an image, to the right, to forward the data. The problem I’ve been having is that my image changes the…