> Here is my modified version which I think works as you want:
>
> def findMinDepthPath(n):
> if n <= 0: raise ValueError
> elif n==1:
> return 0
> elif n==2 or n==3:
> return 1
> else:
> d1 = findMinDepthPath(n-1)+1
> d2 = d3 = (d1+1) # initialize
On Sat, Oct 3, 2015 at 11:55 AM, Alan Gauld <alan.ga...@btinternet.com> wrote:
> On 03/10/15 19:10, C Smith wrote:
>>>
>>> Here is my modified version which I think works as you want:
>>>
>>> def findMinDepthPath(n):
>>> if n <= 0: r
On Mon, Sep 28, 2015 at 1:27 PM, Ken Hammer wrote:
> A simple "type" problem?
>
> The following code works as a py file with the XX'd lines replacing the two
> later "raw_input" lines.
> Why do the "raw_input" lines yield a TypeError: 'str' object is not callable?
> Same
On Mon, Sep 28, 2015 at 4:13 PM, C Smith <illusiontechniq...@gmail.com> wrote:
> On Mon, Sep 28, 2015 at 1:27 PM, Ken Hammer <kfh...@earthlink.net> wrote:
>> A simple "type" problem?
>>
>> The following code works as a py file with the XX'd lines re
Check this guy's youtube channel. He has very basic examples. His
username is thenewboston
On Wed, Sep 17, 2014 at 4:36 PM, Art Pelletier artp...@gmail.com wrote:
I am a beginner with pythons programming I would like to see if their is a
site that has samples programs that I can practice
Finney ben+pyt...@benfinney.id.au wrote:
Peter Otten __pete...@web.de writes:
C Smith wrote:
Nice, these are useful tools. I have been building something with
just basic stuff and avoiding learning any libraries. If I wanted to
get some insight on a larger program that is about 1000 lines
solved your problem, unfortunately my
emails are coming in slowly and out of order, but I have a suggestion:
On Thu, Jul 31, 2014 at 03:53:48PM -0400, C Smith wrote:
I am on OSX, which needs to escape spaces in filenames with a backslash.
Same as any other Unix, or Linux, or, indeed, Windows
I am on OSX, which needs to escape spaces in filenames with a backslash.
There are multiple files within one directory that all have the same
structure, one or more characters with zero or more spaces in the
filename, like this:
3 Song Title XYZ.flac.
I want to use Python to call ffmpeg to convert
. It's well documented, check
Google.
I guess you mean that the ability to change multiple files with ffmpeg
is possible. I hadn't considered that but I would rather do it with
Python, just for the practice.
On Thu, Jul 31, 2014 at 4:36 PM, Emile em...@salesinq.com wrote:
On 7/31/2014 1:19 PM, C
backslashes or something with strings?
On Thu, Jul 31, 2014 at 5:53 PM, C Smith illusiontechniq...@gmail.com wrote:
Change:
subprocess.call(['ffmpeg', '-i', filename, str(track)+'.mp3'])
to:
subprocess.call(['ffmpeg', '-i', '%s' % filename, str(track)+'.mp3'])
I still get the same errors, the filenames
Okay I messed up with slash instead of backslash, so the re.sub()
works, but I am still curious about the previous question.
On Thu, Jul 31, 2014 at 6:14 PM, C Smith illusiontechniq...@gmail.com wrote:
Even when I am using:
re.sub('/s', '\\/s', filename)
I am still getting the same output
. So, I
am still wondering about that too.
On Thu, Jul 31, 2014 at 6:20 PM, C Smith illusiontechniq...@gmail.com wrote:
Okay I messed up with slash instead of backslash, so the re.sub()
works, but I am still curious about the previous question.
On Thu, Jul 31, 2014 at 6:14 PM, C Smith
, but I have a suggestion:
On Thu, Jul 31, 2014 at 03:53:48PM -0400, C Smith wrote:
I am on OSX, which needs to escape spaces in filenames with a backslash.
Same as any other Unix, or Linux, or, indeed, Windows.
There are multiple files within one directory that all have the same
structure
woops, I see it pathname != filename
On Thu, Jul 31, 2014 at 6:55 PM, C Smith illusiontechniq...@gmail.com wrote:
for track, filename in enumerate(os.listdir(directory), 1):
It seems kinda counter-intuitive to have track then filename as
variables, but enumerate looks like it gets passed
Works now, thanks!
On Thu, Jul 31, 2014 at 6:57 PM, C Smith illusiontechniq...@gmail.com wrote:
woops, I see it pathname != filename
On Thu, Jul 31, 2014 at 6:55 PM, C Smith illusiontechniq...@gmail.com wrote:
for track, filename in enumerate(os.listdir(directory), 1):
It seems kinda counter
Huh, that is quite an annoyance about changing the order though. Any
ideas about that? I will look into it further in the meantime...
On Thu, Jul 31, 2014 at 6:57 PM, C Smith illusiontechniq...@gmail.com wrote:
Works now, thanks!
On Thu, Jul 31, 2014 at 6:57 PM, C Smith illusiontechniq
thanks, got it
import os, subprocess, re
directory = 'abs/path'
for track, filename in enumerate(os.listdir(directory), 1):
pathname = os.path.join(directory, filename)
subprocess.call(['ffmpeg', '-i', pathname, filename+str(track)+'.mp3'])
On Thu, Jul 31, 2014 at 7:02 PM, C Smith
or more accurately
import os, subprocess, re
directory = '/abs/path'
for track, filename in enumerate(os.listdir(directory), 1):
pathname = os.path.join(directory, filename)
subprocess.call(['ffmpeg', '-i', pathname, filename[:-5]+'.mp3'])
On Thu, Jul 31, 2014 at 7:13 PM, C Smith
Nice, these are useful tools. I have been building something with just
basic stuff and avoiding learning any libraries. If I wanted to get
some insight on a larger program that is about 1000 lines, would that
be doable here?
On Thu, Jul 31, 2014 at 7:37 PM, Peter Otten __pete...@web.de wrote:
C
I agree very much. I feel like I might have a learning disability when
I try to reference the official Python docs for something that seems
like it should be a very common task.
On Sat, Jul 5, 2014 at 1:31 PM, Deb Wyatt codemon...@inbox.com wrote:
I am betting that a big reason newbies don't go
Learning Python Design Patterns, by Gennadiy Zlobin
Let us know when your book is done!
On Mon, Jun 30, 2014 at 7:05 AM, Bob Williams
li...@barrowhillfarm.org.uk wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 29/06/14 23:41, Alan Gauld wrote:
I'm looking for tips for an appendix to
Sorry, typing is hard.
*You will need to use virtualenv
On Thu, May 22, 2014 at 2:40 PM, C Smith illusiontechniq...@gmail.com wrote:
You can't use apt-get or similar to install 3.1.
You will need to virtualenv.
On Thu, May 22, 2014 at 12:22 PM, Alex Kleider aklei...@sonic.net wrote:
On 2014
You can't use apt-get or similar to install 3.1.
You will need to virtualenv.
On Thu, May 22, 2014 at 12:22 PM, Alex Kleider aklei...@sonic.net wrote:
On 2014-05-22 06:17, Markos wrote:
Hi,
I'm learning Python and I'm using Debian 6.0 (squeeze)
The installed version is 2.6.6. (python -V)
You can test out a condition like this in IDLE like so:
while 6:
print yes its true
break
while 0:
print yes its true
break
while -1:
print yes its true
break
emptyList = []
while emtpyList:
print yes its true
break
This way you don't have to deal with an
Of course that isn't very useful code. I thought it might be a useful
quick test for someone learning how while loops treat different
values.
On Tue, May 20, 2014 at 2:46 PM, Danny Yoo d...@hashcollision.org wrote:
On Tue, May 20, 2014 at 11:44 AM, C Smith illusiontechniq...@gmail.com
wrote
That looks pretty normal. I don't see any errors.
On Wed, May 14, 2014 at 5:42 AM, Tao Zhu zxl_...@126.com wrote:
Hi everyone,
when I use python, the problem occured. when I used the command python -v,
the results are listed as follows. could you tell me what wrong?
$ python -v
# installing
What are you trying to do?
On Wed, May 14, 2014 at 12:24 PM, C Smith illusiontechniq...@gmail.com wrote:
That looks pretty normal. I don't see any errors.
On Wed, May 14, 2014 at 5:42 AM, Tao Zhu zxl_...@126.com wrote:
Hi everyone,
when I use python, the problem occured. when I used
This might be useful for reading values from a text value into a dictionary:
https://stackoverflow.com/questions/17775273/how-to-read-and-store-values-from-a-text-file-into-a-dictionary-python
On Wed, May 14, 2014 at 7:00 PM, Danny Yoo d...@hashcollision.org wrote:
Program read TXT file
Thanks to everyone.
practice. That programming doesn't have to be a solitary thing needs
to be strongly emphasized, because the media likes to exaggerate,
Yes, This can't be stressed too much. Industrial coding is a team activity not
a solo process.
This is particularly good advice for me.
Freeside is more makers. I haven't gone but have known people that
have. You might find some arduino supposedly, but not much coding
otherwise and you have to pay membership fees. It is more social than
technical, I think. And your car will probably be broken into. I will
check out the
I think that is going to be my new wallpaper.
On Mon, May 12, 2014 at 8:25 PM, Martin A. Brown mar...@linux-ip.net wrote:
Hello,
10 Pick one favorite specific topic, any topic (XML parsing; Unix
process handling; databases). The topic matters for you.
Learn it deeply. Keep
Hey Glen, include the error you are getting. It will make answering
your question easier. How are you running this program, in an IDE?
On Sat, May 10, 2014 at 11:16 PM, Glen Chan gchan...@msn.com wrote:
Hello, I am a student trying to figure out Python. I am getting errors that
I don't know how
I have never known anyone that works in this industry. I got one job
transforming xml (should have used xslt, ended up using sed and python
regex scripts) where the guy asked me how much I wanted and I threw
200 bucks out there because I could get a room for two weeks at that
cost. He just laughed
a career in IT, you need to finish high school. You
would be wise to get a degree.
My $0.02.
Tim
On Sun, May 11, 2014 at 7:12 PM, C Smith illusiontechniq...@gmail.com
wrote:
I have never known anyone that works in this industry. I got one job
transforming xml (should have used xslt
://wiki.python.org/moin/Generators
On Wed, May 7, 2014 at 7:27 PM, C Smith illusiontechniq...@gmail.com wrote:
A topic came up on slashdot concerning intermediate programming,
where the poster expressed the feeling that the easy stuff is too easy
and the hard stuff is too hard.
Someone did
I guess intuiting efficiency doesn't work in Python because it is such
high-level? Or is there much more going on there?
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
using Dictionaries,Lists.embedded while lists,for loops:
Thank you,. C. Smith for responding to my help plea on Python-Tutor.org. One
version of the Hang Man problem is listed in the textbook,but it doesn't
use Dictionaries,Lists,embedded while lists;so I am fairly flummoxed as to
what is needed
Hey, you will want to include some code to show your progress so far.
Can you write a basic program and then work the requirements into it?
Do you have some idea of where to start? Are you supposed to modify a
completed version of hangman that is in your text, or come up with
an original 'hangman'
ordered_keys = word_count.keys()
sorted(ordered_keys)
sorted() does not modify the list, but returns a sorted version of the
list for me on Python 2.7
my_sorted_list = sorted(ordered_keys)
This will alphabetize all of the words, regardless of frequency.
print (All the words and their frequency
.split() will split things based on whitespace or newlines. Do you know
that your file is only going to contain things that should convert to
floats? If you post your entire code, the error you have included will be
more helpful as it points to a certain line. The last line in your code has
(stri)
That is definitely more useful information in answering your questions.
Whenever you see the error you are getting:
NameError: name 'smv_guessNumber' is not defined
That means you are using a variable, in this case 'smv_guessNumber', that
has not been created yet.
The reason this is happening
I should probably clarify that this list is mainly for python2.7, correct
me if I am wrong.
On Mon, Apr 28, 2014 at 1:49 PM, C Smith illusiontechniq...@gmail.comwrote:
That is definitely more useful information in answering your questions.
Whenever you see the error you are getting
The reason this is happening here is you need to import sys.
I don't know why you would think importing sys would fix this.
docs say it accepts from sys.stdin
On Mon, Apr 28, 2014 at 1:55 PM, Philip Dexter philip.dex...@gmail.comwrote:
On Mon, 28 Apr 2014, C Smith wrote:
I
, C Smith illusiontechniq...@gmail.comwrote:
The reason this is happening here is you need to import sys.
I don't know why you would think importing sys would fix this.
docs say it accepts from sys.stdin
On Mon, Apr 28, 2014 at 1:55 PM, Philip Dexter philip.dex
Just glancing at your work, I see you have curly braces around what looks
like it should be a list. If you are concerned with the order of your
output, dictionaries do not have a concept of order.
On Sat, Apr 26, 2014 at 3:16 PM, Suhana Vidyarthi suhanavidyar...@gmail.com
wrote:
Hi Danny,
err, set also is unordered. I can see you are using set for a reason, but
has no concept of order.
On Sat, Apr 26, 2014 at 3:20 PM, C Smith illusiontechniq...@gmail.comwrote:
Just glancing at your work, I see you have curly braces around what looks
like it should be a list. If you
incorrect and if there is some other function that can be used to
display the output in desired order but don't see it possible thats why was
wondering if any of you Python gurus have any inputs for me :-)
On Sat, Apr 26, 2014 at 12:36 PM, C Smith illusiontechniq...@gmail.comwrote:
err, set
You can get python 3.4 to work on your mac, but it has 2.5 or 2.4 which the
OS uses and things can get very messed up if you don't know what you are
doing. You should use virtualbox to run virtual OS's on your mac without
messing up your main computer.
You should probably describe what kind of
how could someone know enough to write their own web-scraping program and
NOT know that this is not about python or how to get around this problem?
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
Would this be a time when regex is necessary? Maybe:
\b[^.]*quarantine[^.]*\.[a-zA-Z]*\b
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
You will not find much help in getting a program to 'just work' regardless
of your own experience. My advice would be to try and run small parts at a
time to pinpoint where the problem is. Are you opening and reading the file
properly? Are you iterating over the read file properly? Does your html
yourlisthere.pop() will return the last element in the list and change the
list so it no longer contains the element. yourlisthere.push(x) will add x
to the end of the list. Works on more than just lists
___
Tutor maillist - Tutor@python.org
To
Is the only problem that your code is giving unexpected results, or that it
doesnt run or what?
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
It is hard to see things like images and attachments. I think purely html
is preferred, but i would have to look over 'the list rules' again.
You should look into dictionaries as the structure to hold your info.
___
Tutor maillist - Tutor@python.org
To
You are thinking of
is what you want
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
hi list,
i understand the general idea of recursion and if I am following well
written code I can understand how it works, but when I try to write it for
myself I get a bit confused with the flow.
I was trying to turn an ackerman function into python code for practice and
I tried writing it like
hi list, i am trying the MIT opencourseware assignments.
one was to find the 1000th prime.
since this isn't actually my homework, I modified the solution as I would
like to collect lists of primes and non-primes up to N, also some log()
ratio to one comparison.
here is what I came up with on
I found a book at the local library that covers python but it's 2.2.
I already have been using 2.7 for basic stuff and would like to know if it's
worth my time to read this book.
Are there any glaring differences that would be easy to point out, or is it
too convoluted?
Also, am I correct in
I found a book at the local library that covers python but it's 2.2.
I already have been using 2.7 for basic stuff and would like to know if it's
worth my time to read this book.
Are there any glaring differences that would be easy to point out, or is it
too convoluted?
Also, am I correct in
--request for a method of sorting disk files based on size so as to
fill backup disks--
You may want to check out the karp.py routine posted at
http://aspn.activestate.com/ASPN/Mail/Message/python-Tutor/749797
Right now it is coded to split N numbers into 2 groups that have sums
as nearly
After posting the suggestion about splitting a string that contained a
quoted string, I looked back at my (at least I think its mine) flatten
routine and didnt see anything like it at ASPN. Before I would post it
there, does anyone see any problems with this non-recursive approach?
I know
From: Alan Gauld [EMAIL PROTECTED]
With other words I'd like to tell Python: Convert into a float if
possible, otherwise append anyway.
[ (type(x) == type(5) and float(x) or x) for x in mylist ]
This is a perfect opportunity to give the reminder that the conversion
functions are also types that
gerardo arnaez wrote:
On Mon, 28 Mar 2005 09:27:11 -0500, orbitz orbitz at
drorbitz.ath.cx
wrote:
Floats are inherintly inprecise. So if thigns arn't working like
you
expect don't be surprised if 0.15, 0.12, and 0.1 are closer to the
same
number than you think.
Are you telling me
On Tuesday, Mar 22, 2005, at 15:34 America/Chicago,
[EMAIL PROTECTED] wrote:
When I adjust coumadin doses I normal have to use whole or half pills
of the medicien the patient already has.
Fer Instance, if a pt takes 5mg of coumadin a day, that's 35mg of
coumadin week
and suppose I do a test
On Wednesday, Mar 23, 2005, at 04:00 America/Chicago,
[EMAIL PROTECTED] wrote:
Now it would be fine to have an *equally fast*
infinite prime number generator.
Has anybody any suggestions?
I think when you add the condition of it being an infinite generator,
you are changing the rules and can't
On Tuesday, Mar 22, 2005, at 05:01 America/Chicago,
[EMAIL PROTECTED] wrote:
I met a similar question.
what if one has L = [[1,2],[3,4]], K = [100, 200]
How to 'zip' a List like [[1,2,100], [3,4,200]]?
I would do something like:
###
for i in range(len(L)):
L[i].append(K[i])
###
/c
Hi Gregor,
I had done the same thing. I also noted that assigning (or inserting)
an element into a list is faster than creating a new list:
l.insert(0,2) is faster than l = [2]+l.
###
def sieve (maximum):
if maximum 2: return []
limit = int(maximum**0.5)
nums =
On Thursday, Mar 17, 2005, at 17:49 America/Chicago,
[EMAIL PROTECTED] wrote:
On my system, it took 415 seconds to generate a list of primes 50,000
using range, but only 386 seconds if I use the same code, but with
xrange instead.
If you only calculate y up to sqrt(x) you will see a dramatic
On Sunday, Mar 13, 2005, at 05:01 America/Chicago,
[EMAIL PROTECTED] wrote:
if this is not a program please teach me what is a
program and what i need to know to write them and if this is a program
teach me
how to write better programs i can use outside of the python shell...
OK, how about this
Thanks to Sean and Kent for replies. I found a site that provided some
good examples, too, at
http://www.cafepy.com/articles/python_attributes_and_methods/
ch03s02.html
Here's a blurb from the title page:
wep page excerpt
Shalabh Chaturvedi
Copyright © 2004 Shalabh Chaturvedi
This book
Hello,
After learning about the new class behavior, I am trying to implement a
circular type list where, for example, you can compare the nth value to
the (n+1)th value without worrying about going past the end of the
list. (An old approach might be to create a function that converts a
given
71 matches
Mail list logo