Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: semantics of comma inside array brackets
Post: RE: semantics of comma inside array brackets

Thanks for your answer. It seems like dat[:,i] prints the i. index of every row, so the i. column of every row. dat[i:,j] seems to print the first j elements of row i. But this is kind of conflicting,...
usercat123 Data Science 2 1,367 Apr-23-2022, 09:08 AM
    Thread: semantics of comma inside array brackets
Post: semantics of comma inside array brackets

hi, I am trying to understand a piece of code, namely import matplotlib.pyplot as plt import numpy as np expdat = np.genfromtxt(fname='expDat.txt', delimiter=',', dtype=np.in...
usercat123 Data Science 2 1,367 Apr-23-2022, 08:09 AM
    Thread: extract and plot data from a txt file
Post: RE: extract and plot data from a txt file

Okay sorry :)
usercat123 Data Science 2 1,237 Apr-20-2022, 06:50 PM
    Thread: extract and plot data from a txt file
Post: extract and plot data from a txt file

Hello, I want to extract data from a txt file and plot it using the matplot.pyplot module. The format of the file is as follows: "", "V1", ..., "Vn" "1", data1_1, ..., data1_n ... "m", datam_1,...,...
usercat123 Data Science 2 1,237 Apr-20-2022, 03:56 PM
    Thread: bug in subset sum algorithm
Post: RE: bug in subset sum algorithm

Yes, I was aware that there will be an exception if arr[i] > k for some i. arr = [2,4,5,6] print(driver(arr,19))I get True with line 12 executed and False if its not executed.
usercat123 General Coding Help 3 1,385 Feb-06-2022, 04:45 PM
    Thread: bug in subset sum algorithm
Post: bug in subset sum algorithm

Given an array of integers and a value k, return True if there exists a subset of elements of the array that sums up to k. This is my algorithm. Initially, the line that I commented was included and t...
usercat123 General Coding Help 3 1,385 Feb-06-2022, 12:23 PM
    Thread: shallowcopy of an object
Post: RE: shallowcopy of an object

(Feb-05-2022, 05:13 AM)deanhystad Wrote: "res = [[]]" creates a variable local to driver(). "res = res + temp" creates a variable local to subsets(). Not only are these different variables, but th...
usercat123 General Coding Help 3 1,456 Feb-05-2022, 01:52 PM
    Thread: shallowcopy of an object
Post: shallowcopy of an object

Can somebody explain to me why in the following code, temp is equal to res after the loop body statement? I have tested it with input [1] and after the loop executes temp is as I said equal to the new...
usercat123 General Coding Help 3 1,456 Feb-04-2022, 08:30 PM
    Thread: longest palindromic subsequence DP solution bug
Post: RE: longest palindromic subsequence DP solution bu...

Thanks to both of you, it seems to work now.
usercat123 General Coding Help 9 2,368 Feb-03-2022, 02:22 PM
    Thread: longest palindromic subsequence DP solution bug
Post: RE: longest palindromic subsequence DP solution bu...

(Feb-02-2022, 07:20 PM)deanhystad Wrote: And the longest palindrome I see in "GATTACAGAT" is "ATTA". I think your output should be 4, not 6 (or 5). The question asks for a sequence not substring, t...
usercat123 General Coding Help 9 2,368 Feb-02-2022, 07:27 PM
    Thread: longest palindromic subsequence DP solution bug
Post: RE: longest palindromic subsequence DP solution bu...

(Feb-02-2022, 05:38 PM)deanhystad Wrote: The primary logic flaw is thinking your code is readable. Some comments would be nice. Sorry about that, I added comments.
usercat123 General Coding Help 9 2,368 Feb-02-2022, 06:24 PM
    Thread: longest palindromic subsequence DP solution bug
Post: longest palindromic subsequence DP solution bug

Hey, I am trying to code the following problem: given a string find the length of the longest palindromic subsequence and for the input "GATTACAGAT" I get ouput 5 instead of the expected 6. I cannot ...
usercat123 General Coding Help 9 2,368 Feb-02-2022, 03:52 PM
    Thread: error "list object has no attribute transpose()"
Post: RE: error "list object has no attribute transpose(...

Thanks for your answer. If I do that it throws Error:Traceback (most recent call last): File "FullyConnectedNetwork.py", line 143, in <module> network.SGD(test_data,1,1,1) File "FullyC...
usercat123 Data Science 4 4,288 Jan-28-2022, 12:01 PM
    Thread: error "list object has no attribute transpose()"
Post: RE: error "list object has no attribute transpose(...

Sorry about that. Error:Traceback (most recent call last): File "FullyConnectedNetwork.py", line 143, in <module> network.SGD(test_data,1,1,1) File "FullyConnectedNetwork.py", line 47, ...
usercat123 Data Science 4 4,288 Jan-27-2022, 09:15 PM
    Thread: error "list object has no attribute transpose()"
Post: error "list object has no attribute transpose()"

Hi, I am trying to build a neural network this is my code import numpy as np import random class QuadraticCost(object): @staticmethod def cost(a,y): return 0.5 * np.linalg.norm(a-y)...
usercat123 Data Science 4 4,288 Jan-27-2022, 07:06 PM
    Thread: building a sudoku solver
Post: RE: building a sudoku solver

Thanks I overlooked that one. On another note, I have now expanded with a sudoku generator. First, I want to generate a valid sudoku but I have made a mistake while doing so. Here is the updated code....
usercat123 General Coding Help 7 2,777 Oct-01-2021, 03:32 PM
    Thread: building a sudoku solver
Post: RE: building a sudoku solver

I'm too dumb to spot the bug, can you tell me whats wrong?
usercat123 General Coding Help 7 2,777 Sep-28-2021, 01:45 PM
    Thread: building a sudoku solver
Post: RE: building a sudoku solver

(Sep-27-2021, 03:32 PM)deanhystad Wrote: "test" will never be printed. The function contains a return that prevents every reaching the print command. It doesn't matter though, because your program...
usercat123 General Coding Help 7 2,777 Sep-27-2021, 03:38 PM
    Thread: building a sudoku solver
Post: building a sudoku solver

Hi, For some reason, a call to solve_sudoku() will not print the solved sudoku, "test" is not even printed and I don't see why. Can anyone help me? import numpy as np def possible(x,y,n): for i ...
usercat123 General Coding Help 7 2,777 Sep-27-2021, 03:07 PM
    Thread: confusion on semantics of code
Post: RE: confusion on semantics of code

Yes, I was working with the AST module. Thanks :)
usercat123 General Coding Help 2 1,690 Jul-21-2021, 07:37 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020