Posts by Natália • 65 points
4 posts
-
1
votes1
answer813
viewsQ: Runtime Error in Python
I made a backtracking program in Python to find a set of M-sized binary strings where any string has a distance greater than d to any other string in the set. But it does not work well when I test…
-
2
votes1
answer555
viewsA: Backtracking in Python
I made it, thank you all! def dist(a,b): k = 0 for i in range (0,20): if a%2 != b%2: k = k + 1 a = a/2 b = b/2 return k def bin(n): nd = 0 pot = 1 while (n > 0): nd = nd + n%2 * pot n = n/2 pot =…
-
2
votes1
answer555
viewsQ: Backtracking in Python
I’m trying to find a subset, of size M, of binary strings of length n, where any string has a distance greater than 2 for any other string in the subset. Where the distance between two strings is…
-
1
votes1
answer968
viewsQ: Attributeerror: 'list' Object has no attribute 'apend'
Why does this errp occur? "Attributeerror: 'list' Object has no attribute 'apend'" with this code? class Stack : def __init__(self) : self.items = [] def push(self, item) : self.items.apend(item)…