Jach Feng writes:
>> > s = "Jack Brandom"
>> > s[3 : -13 : -1]
>> >> 'kcaJ'
>> >> I have no idea how to replace that -13 with a positive index. Is it
>> >> possible at all?
> That's not possible because a positive index is relative to the leftmost item > 0
And the middle index is al
I just wrote
def f(y, N, k = None):
k = k or (N - 1)
return k
I was surprised to find out that 0 == False, so f(7, 31, 0) produces 31.
I'd like 0 to be a valid choice for k.
How do you guys let k be an optional argument such that it defaults to
N - 1?
Thank you.
--
https://mail.pytho
Chris Angelico writes:
> On Sun, Jun 21, 2020 at 2:02 AM Boris Dorestand
> wrote:
>>
>> I just wrote
>>
>> def f(y, N, k = None):
>> k = k or (N - 1)
>> return k
>>
>> I was surprised to find out that 0 == False, so f(7, 31, 0) pr
Chris Angelico writes:
[...]
>> Anyway, I kind of replied just to thank you all for the great group this
>> is. ChrisA, I don't know how can keep up with this newsgroup, but you
>> do. This is crazy. Years go by and when I come back, there you are
>> still. You're priceless.
>
> You're most
David Raymond writes:
>> This is true. I have written 0 as false in C so many times. But
>> clearly for me times have changed... I now look at numbers as a thing
>> in their own special class not to be confused as truth-values. (So much
>> so that I fell for this.) But I confess I still thin
Say we have [1,3,5,7], [2,3], [1,10]. I'd like to generate
[1,2,1]
[1,2,10]
[1,3,1]
[1,3,10]
[3,2,1]
[3,2,10]
[3,3,1]
[3,3,10]
[5, ...]
...
[7,3,10]
The number of input lists is variable. The example shows three lists,
but there could be only one or ten lists or any other
Peter Otten <__pete...@web.de> writes:
> Boris Dorestand wrote:
>
>> Say we have [1,3,5,7], [2,3], [1,10]. I'd like to generate
>>
>> [1,2,1]
>> [1,2,10]
>> [1,3,1]
>> [1,3,10]
>> [3,2,1]
>> [3,2,10]
>> [3,3,
I have 16 values of the period sequence 1, 2, 4, 8, 1, 2, 4, 8, ... I
compute its fourier transform using
>>> from scipy import fft, ifft
>>> x = [1,2,4,8,1,2,4,8]
>>> fft(x)
array([ 30. +0.j, 0. +0.j, -6.+12.j, 0. +0.j, -10. +0.j, 0. +0.j,
-6.-12.j, 0. +0.j])
Now how can I plot