Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Generating number of objects for a game
Post: RE: Generating number of objects for a game
Thank you guys, this idea helped me a lot!
I'd like to know one other thing now, related to mouse events. This is a part of my code:
class ClassName:
def __init__(self):
self.canvas.bin... |
|
dan789 |
General Coding Help |
3 |
2,595 |
Apr-18-2019, 02:04 PM |
|
|
Thread: Binary tree from a list
Post: RE: Binary tree from a list
Simply, this new method should count nodes in a selected subtree, specified by a given node data. This node represents a root of that subtree, whose nodes it has to count. So what do I want to do, is ... |
|
dan789 |
General Coding Help |
14 |
5,548 |
Mar-31-2019, 09:08 PM |
|
|
Thread: Binary tree from a list
Post: RE: Binary tree from a list
It should be non-recursive. And the parameter is just a value of that node (sorry for wrong information in my post above). |
|
dan789 |
General Coding Help |
14 |
5,548 |
Mar-31-2019, 02:20 PM |
|
|
Thread: Binary tree from a list
Post: RE: Binary tree from a list
It´s against project rules. I have to create other method, which counts nodes, but just from the node given as it´s parameter. Therefore I need to find the reference for this node for that parameter, ... |
|
dan789 |
General Coding Help |
14 |
5,548 |
Mar-31-2019, 02:10 PM |
|
|
Thread: Binary tree from a list
Post: RE: Binary tree from a list
Thanks, that works (I also added following lines of code).
Now I met with one another trouble; I shouldn´t use a self attribute whenever in that class (except self.root). I need to use dictionary "no... |
|
dan789 |
General Coding Help |
14 |
5,548 |
Mar-31-2019, 01:41 PM |
|
|
Thread: Binary tree from a list
Post: RE: Binary tree from a list
Well, I get this logic, but here I meet with the following trouble:
dictionary = {parent1 : (1child1, 1child2),parent3 : (3child1, 3child2),parent2 : (2child1, 2child2),...}
self.root = self.Node(hea... |
|
dan789 |
General Coding Help |
14 |
5,548 |
Mar-30-2019, 06:06 PM |
|
|
Thread: Binary tree from a list
Post: RE: Binary tree from a list
So, actually, I can create this tree in a way, where I create a lot of "subtrees" and then while iterating in a list just joining them, right? |
|
dan789 |
General Coding Help |
14 |
5,548 |
Mar-30-2019, 03:41 PM |
|
|
Thread: Binary tree from a list
Post: RE: Binary tree from a list
Well, I'm using a class already, but I need some hint in the aspect of logic - how to create it? I was already thinking about using a queue, could this be useful in my case? |
|
dan789 |
General Coding Help |
14 |
5,548 |
Mar-30-2019, 03:02 PM |
|
|
Thread: Binary tree from a list
Post: Binary tree from a list
Hi all,
I need to create a binary tree, whose data are stored in a list:
[[parent1, one_of_children_from_1],[parent2, one_of_children_from_2],[parent1, one_of_children_from_1],...] #they are in ra... |
|
dan789 |
General Coding Help |
14 |
5,548 |
Mar-30-2019, 02:40 PM |
|
|
Thread: Input as function parameter
Post: Input as function parameter
When we have a function like this:
def function(param1, input=""):
...What´s the variable of that input? How can I use it´s value inside that function? |
|
dan789 |
General Coding Help |
1 |
2,080 |
Mar-08-2019, 03:07 PM |
|
|
Thread: Input as not default method parameter
Post: RE: Input as not default method parameter
Thanks, I will try.
Trying to do this whit setting parameters as default, I stucked at the point where is input="". When we have a function like this:
def function(param1, input=""):
...What´s t... |
|
dan789 |
General Coding Help |
4 |
2,937 |
Mar-08-2019, 02:39 PM |
|
|
Thread: Input as not default method parameter
Post: Input as not default method parameter
Hi all.
I have a project, containing class and this method:
...
def start(self, input="", number_occur, max_value):
self.mem = Editor(number_occur, max_value)
...Our testing script has pr... |
|
dan789 |
General Coding Help |
4 |
2,937 |
Mar-08-2019, 12:26 PM |
|
|
Thread: Deleting the first item in linked list
Post: RE: Deleting the first item in linked list
llist.next = llist.next.next works at least in my case. Is it correct? |
|
dan789 |
General Coding Help |
7 |
3,990 |
Mar-05-2019, 04:39 PM |
|
|
Thread: Deleting the first item in linked list
Post: RE: Deleting the first item in linked list
Something like this?
llist.data = llist.next.data |
|
dan789 |
General Coding Help |
7 |
3,990 |
Mar-05-2019, 04:24 PM |
|
|
Thread: Deleting the first item in linked list
Post: RE: Deleting the first item in linked list
I could change a refference to the second item? But not sure how to do this using a separate function remove_first. |
|
dan789 |
General Coding Help |
7 |
3,990 |
Mar-05-2019, 03:57 PM |
|
|
Thread: Deleting the first item in linked list
Post: Deleting the first item in linked list
Hello, this is what I have so far:
class Linked_list:
def __init__(self, data, next=None):
self.data, self.next = data, next
def print_list(list):
while list is not None:
pri... |
|
dan789 |
General Coding Help |
7 |
3,990 |
Mar-05-2019, 03:12 PM |
|
|
Thread: Replacing list items
Post: RE: Replacing list items
I don´t know why, but it still doesn´t work.. |
|
dan789 |
General Coding Help |
3 |
2,298 |
Feb-01-2019, 02:39 PM |
|
|
Thread: Replacing list items
Post: Replacing list items
Hello, this is what I have so far:
value = 0.1
for k in range(len(self.my_list)):
self.my_list[k][1] = value * self.my_list[k][1]my_list is something like this:
[[string, int], [string, int], [s... |
|
dan789 |
General Coding Help |
3 |
2,298 |
Feb-01-2019, 02:15 PM |
|
|
Thread: Downloading a module Xlsxwriter
Post: RE: Downloading a module Xlsxwriter
Oh of course, thank you! :) |
|
dan789 |
General Coding Help |
6 |
11,263 |
Jan-26-2019, 02:13 PM |
|
|
Thread: Downloading a module Xlsxwriter
Post: RE: Downloading a module Xlsxwriter
Ok, I have done it, I also installed that pip Xlsxwriter, this appeared:
[Image: https://i.ibb.co/QnycvCV/Python-download-module2.png]
But as soon as I want to import XlsxWriter, there just appears:... |
|
dan789 |
General Coding Help |
6 |
11,263 |
Jan-26-2019, 01:52 PM |