Re: [Tutor] Variable in tkinter?

2016-07-23 Thread R. Alan Monroe
> button = tkinter.Button(frame, text='Up', command=click_up) > button = tkinter.Button(frame, text='Down', command=click_down) > when I first looked at it I thought it would not work, thinking that the > second reference to button = would over write the first one. It DOES overwrite it, in this

Re: [Tutor] New at Python

2014-10-05 Thread R. Alan Monroe
> while loop to compute > the sum of the cubes of the first n counting numbers > do you have any suggestions as to how I need to look at a problem > and to “identify” what exactly it is asking for, Can you do it on paper? If I gave you "5" as a starting point, could you write down on your paper 1

Re: [Tutor] sorting distances for nearest neighbor

2014-08-29 Thread R. Alan Monroe
> How do you sort distances to prepare for nearest neighbor when the > results returned look like this Have you read up on the "key" parameter for Python's sort() function? You can use that, along with split() to do this. Alan ___ Tutor maillist - Tu

Re: [Tutor] Anti-Patterns in Python Programming

2014-07-12 Thread R. Alan Monroe
> what is a hash value? Some clever person back in the 1950s realized that computers were better at numbers than names. So they came up with some gimmicks to convert names to numbers. It was probably something fancier than "a=1, b=2, etc. Now let's add up all the letters of the person's name to ma

Re: [Tutor] I am having difficulty grasping 'generators'

2014-05-27 Thread R. Alan Monroe
> I need an explanation so simple as using the expression 'print ()', in this > case 'yield'. > Python 2.6 here! Ever write any C programs with static variables? Generators can be explained in those terms if you have experience with them. Alan ___ Tut

Re: [Tutor] class to function

2014-05-25 Thread R. Alan Monroe
> can you > guys help explain. super thanks A class is like a blueprint. An instance of that class is like a house built from that blueprint. Think about it. An infinite number of houses could be constructed using those blueprints. But the architect only had to draw them once. __init__() is like

Re: [Tutor] Set values from list as per user input

2014-05-21 Thread R. Alan Monroe
> take value 15 from list Hint: use square brackets to choose a particular item from a list. test = ['first', 'second', 'third'] test[0] would refer to 'first' for example. Alan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscri

Re: [Tutor] How to create web interface?

2014-05-20 Thread R. Alan Monroe
> I don't understand how precisely the web page would communicate with > the python program. In the simplest case, the webserver software executes your script. Whatever you print() _is_ the webpage. The webserver sends whatever you print() to the user's browser. http://en.wikipedia.org/wiki/Comm

Re: [Tutor] New to Python

2014-04-28 Thread R. Alan Monroe
> 1. Write a program module with at least two functions. Hint: "def" is the Python keyword used to define a function. You can read all about def in the docs on python.org. Alan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscripti

Re: [Tutor] (no subject)

2014-03-02 Thread R. Alan Monroe
> I am stuck there my loop is not working > ... > I know I have to use if and > else statement but I'm not able to do so :( Hint: Set the assignment aside and write a couple smaller practice programs. Like a very simple one that just asks for a word and prints that word. Or a simple one that che

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-12 Thread R. Alan Monroe
> When running it, either returned values are wrong or the script > seems to enter in an infinite loop showing no return values at all. One other tip: "for" loops are usually more practical when you know exactly how many times you want to loop (100 coin flips). "while" loops are usually more prac

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-12 Thread R. Alan Monroe
> Can somebody explain the reason of the bug. I think you have an indentation goof on line 24 in the "wrong" version (the else clause). Alan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org

Re: [Tutor] Better flow for this?

2014-02-12 Thread R. Alan Monroe
> You keep taking turns until you get home or die. Each turn has 4 > phases. > while playing: > #phase 1 - fly every turn, you might die > #phase 2 - stuff shoots at you every turn, you might die > #phase 3 - may or may not get an event card, with certain cards you might > die > #

Re: [Tutor] Better flow for this?

2014-02-12 Thread R. Alan Monroe
> Also explain the logic in plain words. Else, we can only guess. Were the comments not enough? You keep taking turns until you get home or die. Each turn has 4 phases. while playing: #phase 1 - fly every turn, you might die #phase 2 - stuff shoots at you every turn, you might die #ph

[Tutor] Better flow for this?

2014-02-11 Thread R. Alan Monroe
I started on an implementation of a solitaire board game simulating a B52 bombing run ( http://victorypointgames.com/details.php?prodId=119 ). It seems like there ought to be a better way to structure this program flow, but it's escaping me at the moment. (pseudo code) - playing=True while pla

Re: [Tutor] Generate list-of-transforms

2013-12-05 Thread R. Alan Monroe
> What does the OP actually want? I started writing another fake defrag program to entertain myself in a little downtime at work. The FAT-styled "drive" is just a Python list of integers where each element points to the the next "block" of the fictitious "file", with the last element of any given

Re: [Tutor] Generate list-of-transforms

2013-12-05 Thread R. Alan Monroe
> There is a name for this: it is called a RANK TABLE. Handy. That should help. Alan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Generate list-of-transforms

2013-12-04 Thread R. Alan Monroe
Given two lists, before and after a sort: 0 1 2 3 4 - before: 3 1 2 5 4 after: 1 2 3 4 5 Is there a well-known algorithm that can give me the list-of-transforms that got me from before to after? e.g.: first-to-zeroth, zeroth-to-second, second-to-first fourth-to-third

Re: [Tutor] help with postgreSQL and .csv

2013-09-02 Thread R. Alan Monroe
> my goal is to make it write all the picture url values separated by > a ';' in just one field and to input the data correctly.   I haven't used postgresql much. Could it be you're just missing path_picture as part of your data value? i.e. UPDATE hotel SET path_picture = + hotel_url UPDATE hotel

Re: [Tutor] Questions about classes

2012-11-12 Thread R. Alan Monroe
> 2. Why use a class in the first place? What is the purpose of > constructing a class instead of just writing a program with a bunch > of functions? Sometimes, you DO just write programs with functions. A class can be useful if you have a bunch of a thing. Like a monster. Each monster can know

[Tutor] geekdad-puzzle-of-the-week-extreme-products

2012-08-20 Thread R. Alan Monroe
People hunting for Python projects to work on might get a kick out of this puzzle: http://www.wired.com/geekdad/2012/08/geekdad-puzzle-of-the-week-extreme-products/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: h

Re: [Tutor] Pydev + Remote System Explorer (RSE) : problems with local imports when working localy

2012-07-31 Thread R. Alan Monroe
Hello learner404, Tuesday, July 31, 2012, 8:02:26 AM, you wrote: > Hello List, > I'm very happy with PyDev plugin for Eclipse as a Python IDE (I'm > on Eclipse 3.7, WinXP with latest Pydev).  > File "C:\Documents and > Settings\myaccount\workspace\RemoteSystemsTempFiles\LOCALHOST\c\Documents > a

Re: [Tutor] starting to learn

2012-07-13 Thread R. Alan Monroe
> So starting from scratch, how-to? print "hello world" Alan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] [Python-Help] What is lambdas in Python??

2011-12-27 Thread R. Alan Monroe
> I really don't get it. What is lambda? I keep seeing it and I > couldn't understand anything online about it. It took me a while to get it too. It's for those rare times when you want a throwaway function. Like you want to do something kind of functioney without going to the trouble of wri

Re: [Tutor] fake defrag revisited

2011-10-09 Thread R. Alan Monroe
>> I did get a semi-working version, but it was crazy inefficient because >> it regenerated the swap list after every move, and it bombed out with >> a IndexError about half the time. I found that moving a single block >> at a time lacked the aesthetic appeal I was hoping for, so I bagged it >> fo

Re: [Tutor] START-UP PROJECT

2011-10-08 Thread R. Alan Monroe
> I really can't figure out what project to take on but would be > prepared to take on anything and get my hand dirtier than before. Popular ones are: http://www.pythonchallenge.com/ http://projecteuler.net/ I also like: http://www.atariarchives.org/basicgames/ http://www.atariarchives.org/moreb

Re: [Tutor] fake defrag revisited

2011-10-05 Thread R. Alan Monroe
> Since all the moves are swaps, it'll be guaranteed to be in a sequence > that converges on the correct final order. Will it be the minimum > number of moves? Definitely not. But that wasn't a requirement, and if > it were, you wouldn't start by building that list of tuples. I did get a sem

Re: [Tutor] fake defrag revisited

2011-10-01 Thread R. Alan Monroe
>> achieve the cosmetic randomness, until I realized the real problem is >> magically determining the correct sequence in which to perform the >> moves without ruining a future move inadverently. >> >> If I move 0-to-1 first, I've now ruined the future 1-to-22 which ought >> to have taken place in

[Tutor] fake defrag revisited

2011-09-30 Thread R. Alan Monroe
I'm revisiting the fake defrag program I posted about a few months ago. The concept is basically a screensaver or light show where you can enjoy watching entropy being reversed as colored blocks order themselves visually. I set it aside for a while because it was too slow, but I finally came up wi

Re: [Tutor] paper scissors

2011-09-23 Thread R. Alan Monroe
>> There are 2 things I don't understand. >> 1. the %s >> 2. the (wins,loses) Did you ever play Mad Libs when you were a kid? http://en.wikipedia.org/wiki/Madlibs Same concept. The %s in Python is just like the blank spaces in a Mad Lib game. The items in parentheses after a percent sign are th

Re: [Tutor] Please review my code

2011-09-16 Thread R. Alan Monroe
> It was only tested on a Windows Box, but I see no reason why it would not > work on Unix family. https://github.com/janus/Text-Twist > I need you comments. I think you forgot to upload some needed images along with the python code: ['abase', 'abased', 'abed', 'ads', 'baa', 'baas', 'bad', 'bade

Re: [Tutor] Can't find error :-(

2011-08-28 Thread R. Alan Monroe
> /usr/local/bin/AddressBook: line 6: syntax error near unexpected token `(' > /usr/local/bin/AddressBook: line 6: `name = raw_input("Type the Name - leave > blank to finish")' Were you accidentally trying a python 3 tutorial when your machine only has python 2 installed (or vice versa)? Alan

Re: [Tutor] problem reading script

2011-07-02 Thread R. Alan Monroe
> Suggestions for "a programmers font" gratefully received. DejaVu Sans Mono ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Medical Decision-Making Question

2011-06-13 Thread R. Alan Monroe
> a) How's the best way to make it so I can have a user type in a list of > symptoms and then have the computer tell the user the possible diseases that > share those symptoms? Good question. The first decent idea that came to mind was searching through a cartesian join of all diseases & symptom

Re: [Tutor] [OT] Re: Floating Point Crazines

2011-06-12 Thread R. Alan Monroe
> Python's floats have 52 *binary* places of precision, or approximately > 15 *decimal* places. So even though we may not be able to physically > build a machine capable of aiming a laser to a precision of > 0.001 degrees, at least we can be comforted by the knowledge > that a C double o

[Tutor] [OT] Re: Floating Point Craziness

2011-06-12 Thread R. Alan Monroe
> * Or you just get used to the fact that some numbers are not exact in > floating point. This got me thinking. How many decimal places do you need to accurately, say, aim a laser somewhere in a 180 degree arc accurately enough to hit a dime on the surface of the moon? Alan ___

Re: [Tutor] (no subject)

2011-04-22 Thread R. Alan Monroe
> Hello, I am just learning Python 3.0 and I am working on this > problem. I need to know what the output would be. What happened when you ran it on your computer? You _did_ try that, right? Alan ___ Tutor maillist - Tutor@python.org To unsubscribe o

Re: [Tutor] First Game Attempt

2011-04-18 Thread R. Alan Monroe
> I was reading Pygame API for a month and made out a very basic ,small game > named as "Hungry Snake" as practice. Not bad! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/t

Re: [Tutor] Simplistic drive simulation

2011-03-14 Thread R. Alan Monroe
> "R. Alan Monroe" wrote >> Neither of these seem like they'd scale very well (say, up to the >> resolution of your screen, with one block per pixel). The end goal >> is >> just a basic do-nothing light show that simulates >> fragmentation/defra

[Tutor] Simplistic drive simulation

2011-03-12 Thread R. Alan Monroe
I'm trying to mentally plan out the most bare bones drive simulation possible, but I have this nagging feeling that I'm missing something. I was just going to start with, say, 16 or 64 "blocks", then randomly add and delete ficticious "files" (which won't have any actual content - I'm just trying t

Re: [Tutor] creating classes while coding

2011-02-20 Thread R. Alan Monroe
> I'll freely admit that I do not come from an OOP programming > background, so designing classes is not my first impulse when > writing code. Am I missing something? In my book, no, you're not missing something. I refer to it as "drinking the OO kool-aid". It's not compulsory. I just use it when

Re: [Tutor] Exercise suggestions

2011-01-22 Thread R. Alan Monroe
> I just have no idea of what kind of programs to build, Some of the stock answers for this question are: http://projecteuler.net/ http://www.pythonchallenge.com/ I usually suggest porting one of the old games in: http://www.atariarchives.org/basicgames/ Alan ___

Re: [Tutor] "if n % 2 == 0" vs. "if not n % 2" compared for speed: aesthetics lose

2010-11-23 Thread R. Alan Monroe
>>> >> I've always disliked using "if not n % 2"  to test for even/odd ints >>> >> because of its convoluted logic. But I ran some speed tests and found >>> >> it was the way to go over "if n % 2 == 0". >>> > Did you try bitwise-and with 1? >>> What's that? > 2 & 1 >> 0 > 3 & 1 >> 1 >

Re: [Tutor] "if n % 2 == 0" vs. "if not n % 2" compared for speed: aesthetics lose

2010-11-23 Thread R. Alan Monroe
> I've always disliked using "if not n % 2" to test for even/odd ints > because of its convoluted logic. But I ran some speed tests and found > it was the way to go over "if n % 2 == 0". Did you try bitwise-and with 1? Alan ___ Tutor maillist - Tuto

Re: [Tutor] Programs for Newbies?

2010-11-14 Thread R. Alan Monroe
> Any suggestions for a newbie to program while learning python? I am new to > programming and python. Port one of the old games from http://www.atariarchives.org/basicgames/ or similar antique books. Alan ___ Tutor maillist - Tutor@python.org To u

Re: [Tutor] perl or python

2010-10-05 Thread R. Alan Monroe
> Is it better to learn Perl or Python since i can manage only writing > simple bash shell scripts. > Please suggest/guide. Do you already have both installed (seeing bash, I bet you're on some version of Linux, so it's likely you do). You could try writing a very simple "guess my number" game

Re: [Tutor] system()? popen2()? How to execute a command & save itsoutput?

2010-09-30 Thread R. Alan Monroe
>> I'm needing to transfer the following shell construct to Python, >> plus save >> the output of execution: >> FTP_SITE='ftp.somesite.com' >> ftp -a $FTP_SITE <> binary >> prompt off >> cd /some_dir >> dir >> bye >> EOF > Are you sure? It looks like you would be better writing a python > prog

Re: [Tutor] list dll functions?

2010-09-14 Thread R. Alan Monroe
> the win32 lib, but is there any way to simply "examine" a loaded dll > to see all of the functions and attributes it exposes for use? I would http://www.dependencywalker.com/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscriptio

Re: [Tutor] Giving a name to a function and calling it, rather than calling the function directly

2010-09-04 Thread R. Alan Monroe
> if coinToss(1,2) == 1: > heads += 1 > tossNo += 1 > else: > tails += 1 > tossNo += 1 Looking good. You can hoist "tossNo += 1" out of each branch of your if statement too, if you like, to make it even more streamlined (In other words, execute it once, righ

Re: [Tutor] continuous running of a method

2010-08-25 Thread R. Alan Monroe
> Any modern multi-tasking operating system will ensure than a while loop > doesn't kill your computer's responsiveness. A decent operating system > will still remain responsive even at 100% CPU usage. Even Windows does > that! Opinions vary. If you try this on a laptop, the end user will be qui

Re: [Tutor] A file containing a string of 1 billion random digits.

2010-07-18 Thread R. Alan Monroe
> That's the goal of the latest version of my script at > . The best I've been able to do > so far is a file with 800 million digits. I don't think anyone else has suggested this: the numpy module can generate random bytes and has a built-in tofile() method.

Re: [Tutor] conventions for establishing and saving default values for variables

2010-06-16 Thread R. Alan Monroe
> On Tue, Jun 15, 2010 at 2:27 PM, Pete O'Connell > wrote: >> Hi I was wondering if anyone could give me some insight as to the best way >> to get and save variables from a user the first time a script is opened. For >> example if the script prompts something like "What is the path to the >> fold

Re: [Tutor] Odds and even exercise

2010-03-27 Thread R. Alan Monroe
> odd = numbers[::2] > I can't find a way to easily list the even numbers, Hint: You can designate a start number before the first colon. Alan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.or

Re: [Tutor] query

2010-01-31 Thread R. Alan Monroe
> i just don wana index all the characters rather i wana double it too like > ['d','a','v','i','d'] > would b > ['d','dd','a','aa','v','vv','i','ii','d','dd'] > and then i wana replace all non 'd' characters with '.' a dot > i know how replace a specific character, but i don know how to > rep

Re: [Tutor] can any one help

2010-01-31 Thread R. Alan Monroe
> 1 1.1 Write a Python program with a loop that prints out a sequence > of numbers as follows:15 13 11...3 1 -1 Hint 1: Learn about FOR loops. Hint 2: Learn about the RANGE command. Hint 3: Show us some code you have written. Even if yours doesn't work, we can probably spot WHY it doesn't work.

Re: [Tutor] computer basics

2009-12-29 Thread R. Alan Monroe
> I am learning Python slowly.  I would like to begin learning all > about how computers work from the bottom up.  I have an > understanding of binary code.  Where should I go from here; can you > suggest continued reading, on line or off to continue my education? This might be worth a look: Digi-

Re: [Tutor] Generating Unique Permutations

2009-12-18 Thread R. Alan Monroe
> I'm looking for an efficient way to create all the unique, non-duplicated > permutations of a list This may or may not help: http://code.activestate.com/recipes/190465/ Alan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscripti

Re: [Tutor] faster substring replacement

2009-12-15 Thread R. Alan Monroe
> Hi folks, > I'm trying to do something like this: evildict= {'good' : 'bad' , 'love' : 'hate' , 'God': 'Satan'} def make_evil(text) > ...        for a in evildict: > ...              text=text.replace(a, evildict[a]) > ...              return text >     > This works fine, but it so

Re: [Tutor] Monitoring a logfile

2009-12-01 Thread R. Alan Monroe
> Varnish has a dedicated (but not always) reliable logger service. I'd > like to monitor the logs - specifically I want to check that a known > entry appears in there every minute (it should be there about 10 times > a minute). > What's going to be the best way to carry out this kind of check?

Re: [Tutor] sorting algorithim

2009-04-23 Thread R. Alan Monroe
> i know how to print for bubble sort in python, is there a way to > print each pass in the sort so i can see what happens at each step?  > thanks A good first guess would be to try sticking "print list" in there in a few different places. Others will probably point out that "list" is a built-in

Re: [Tutor] Reading from files problem

2009-04-19 Thread R. Alan Monroe
> gradesfile = open("grades.dat", "r > for lines in gradesfile: > [snip] > That's what I have so far but I have a feeling I shouldn't use a for > loop. Actually a for loop seems like the right tool for this job, assuming you really _do_ want to process every line in the file. Alan _

Re: [Tutor] for loop

2009-04-16 Thread R. Alan Monroe
for letter in "python": >  print "Current letter:", letter for chic in "python": >  print "chic:", chic When you write a for-in loop, you can use any variable name you feel like using (letter, chic, mycoolvariable, x, etc.) It's that simple :) Alan __

Re: [Tutor] Simple User Entry Verification

2009-03-14 Thread R. Alan Monroe
> Newbie here who can't figure out why this doesn't work: > start = input("Please enter the starting number.\n>") > print(type(start)) > while type(start)!=float: > start = input("Sorry, that number was invalid.\nPlease enter the starting number.\n>>") > print(type(start)) Google to the r

Re: [Tutor] Simple User Entry Verification

2009-03-14 Thread R. Alan Monroe
> while type(start)!=float: Did you try quotes around the word "float"? Alan ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Text Scatter Plots?

2008-10-01 Thread R. Alan Monroe
> Is there a text graphics module that does say scatter plots or > histograms? I'm thinking of stuff prior to the graphics era of > computing. I'm looking for something really simple. Here's a quick and dirty way to do basic histogram of dice rolls: import random rolls={} for x in range(1)

Re: [Tutor] 6x6 word square solver too slow

2008-04-26 Thread R. Alan Monroe
> I'd suggest googling for 'trie'. Tries are method of > indexing sets of strings by prefix. Ah, will look it up. > As I recall, English words are more similar at the > front, so once you have an indexing scheme you'll > probably to do even less work if you index and search > from the back of t

Re: [Tutor] 6x6 word square solver too slow

2008-04-24 Thread R. Alan Monroe
> Here you call join() at the third level of nested for loops. > And then you call solve recursively at that same level > where join gets called inside 3 more levels of loop. > That effectively means join is getting called at 6 levels > of loop nesting for just one recursive call, but you could >

[Tutor] 6x6 word square solver too slow

2008-04-24 Thread R. Alan Monroe
Any bright ideas on how I can speed this up? It seems REALLY slow for as little as it does. I'm trying to generate word squares like this: P R E Y L A V A O V E R T E N D except 6x6 rather than 4x4. In particular, the profiler indicates that {method 'join' of 'str' objects} is eating an awful lot

Re: [Tutor] String made of list elements' nth characters?

2008-04-20 Thread R. Alan Monroe
> R. Alan Monroe wrote: >> def checksolution(sol): >> maybes = [] >> big = ''.join(solution) >> for x in range(len(sol)): >> maybes.append( big[x::6] ) >> print maybes >> >> solution=['abject',&

Re: [Tutor] String made of list elements' nth characters?

2008-04-20 Thread R. Alan Monroe
> Given a list of 6-letter words: > ['abject','poetry','keypad'] > How do I derive this list: > ['apk', 'boe', 'jey'] > (The original list's first letters, second letters, third letters, > etc.) > I have a text file of 15280 six-letter words and I want to robotically > generate 6x6 word squares.

[Tutor] String made of list elements' nth characters?

2008-04-20 Thread R. Alan Monroe
Given a list of 6-letter words: ['abject','poetry','keypad'] How do I derive this list: ['apk', 'boe', 'jey'] (The original list's first letters, second letters, third letters, etc.) I have a text file of 15280 six-letter words and I want to robotically generate 6x6 word squares. My first attem

Re: [Tutor] how to parse a multiple character words from plaintext

2008-02-23 Thread R. Alan Monroe
> I am looking to parse a plaintext from a document. However, I am > confused about the actual methodology of it. This is because some of > the words will be multiple digits or characters. However, I don't > know the length of the words before the parse. Is there a way to > somehow have open() grab

Re: [Tutor] Program Specification Request

2008-01-16 Thread R. Alan Monroe
>I would like to learn and teach my 2 girls a mini > database GUI program in Python and >They are Girl Scouts (and advanced MS & HS > students) http://davidbau.com/archives/2005/07/29/haaarg_world.html Alan ___ Tutor maillist - Tutor@py

[Tutor] How to get python to differentiate between CR, LF, and CRLF in a string (not a file)?

2007-12-14 Thread R. Alan Monroe
Is is possible to get python to differentiate between CR, LF, and CRLF in a string (not a file)? This is a triple quoted string I've pasted into the source (putting r to indicate raw string made no difference). It contains a mixture of CR, LF and CRLF (I can see this by enabling visible End of Line

Re: [Tutor] Logging with proper format

2007-10-07 Thread R. Alan Monroe
> logger.info("Checked %s records in %s seconds, yielding an average of > \ > %s seconds per record." % (len(self.data), duration, avgquery) ) ^ Remove these spaces. It makes the source code look weird, but the output will be correct. Alan _

[Tutor] A fun puzzle

2007-08-22 Thread R. Alan Monroe
I wrote a lame, but working script to solve this in a few minutes. A fun puzzle. http://weblogs.asp.net/jgalloway/archive/2006/11/08/Code-Puzzle-_2300_1-_2D00_-What-numbers-under-one-million-are-divisible-by-their-reverse_3F00_.aspx Alan ___ Tutor mai

Re: [Tutor] LosingtheexpressivenessofC'sfor-statement?/RESENDwithexample

2007-08-11 Thread R. Alan Monroe
> "Noufal Ibrahim" <[EMAIL PROTECTED]> wrote >> I think such treatment of the various python constructs should be >> reserved for documents like say, "Python for C programmers"( > Actually that's not a bad idea, except I'm not sure such convertion > courses exist? > But it would be useful to ha

Re: [Tutor] Sum of Scores

2007-07-26 Thread R. Alan Monroe
> I want to be able to calculate in the program,.. the total score,.. > either at each successive score,... or when they finally get out. > Not sure how to do that at this point. You're on the right track. You need an additional variable to hold the running total. Alan _

Re: [Tutor] trying to figure out what this means

2007-05-07 Thread R. Alan Monroe
> when you are doing print these two characters keep showing up in this book > "%s" % > What do they do? "Fill in the blank" Kind of like generic paper forms where they have a blank underline for you to fill in your information. Give it a variable name, and it will fill in the "blank" (the %s)

Re: [Tutor] screen scraping web-based email

2007-04-18 Thread R. Alan Monroe
> I'm starting graduate school (econ!) in the Fall; the school I'll be > attending uses Lotus for email You can drive the fat client via COM if you install the Win32 extensions for python. > (I know I could do it with a torturous combination of applescript and Except judging by this, you're on

Re: [Tutor] Talking between C++ & Python ?

2007-04-05 Thread R. Alan Monroe
> I have written a Python app, a company who don't use Python want to integrate > its back end with their C++ coded GUI. > At the moment they are proposing using CSV files to communicate between the > Python & C++, ie C++ GUI generates a CSV, calls Python back end, back end > does the work and

Re: [Tutor] datetime.timedelta Output Format

2007-04-01 Thread R. Alan Monroe
> Is there a way to have the output of "print tis" in the same format as > "print now" and "print tafmsd" in the code below? > Thanks, > Will > savage:~ wallison$ python > Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) > [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin > Type "help", "copy

Re: [Tutor] A string-manipulation question

2007-03-29 Thread R. Alan Monroe
> Hi. I want to learn how to "break down" a string into its component > words, and then process each word somehow. > Is there a way in Python to separate a string into its component words. > Like this: > "I would like to convert an English string (sentence) into Pig Latin." for word in sentenc

Re: [Tutor] Developing a GUI application

2007-03-23 Thread R. Alan Monroe
> On Fri, 23 Mar 2007, Luke Paireepinart wrote: > I've also thought of having a twist here for MP3 files, specifically, > distinguishing between the files' audio frames and identification info > frames, and checksumming only the audio portion; so that two otherwise > identical MP3 files with diffe

Re: [Tutor] sorting data from multiple arrays

2007-03-22 Thread R. Alan Monroe
> hello, I typically run into this problem and I'm not always sure of the most > efficient way to handle it. I often work with multiple arrays of data, say > arrays a, b, and c, and I want to sort the > elements of b and c based on a. for example: > a = [3,2,1,4] > b = ['hi', 'my','name', 'is']

Re: [Tutor] httpd in your laptop?!? serve web pages and wikis in your notebook?

2007-03-03 Thread R. Alan Monroe
> "Luke Paireepinart" <[EMAIL PROTECTED]> wrote >> >>> forth ... while very good for small programs >>> to imbed into controller cpu's to bury inside some machine, > It's a relatively little known fact that Sun use Forth as the > monitor/bootloader in their servers. When you do a shutdown > on a

Re: [Tutor] Starting over with Python

2006-12-13 Thread R. Alan Monroe
> odd =1 while odd <=100: > if (odd%2)==1: > print odd > odd = odd + 1 > - > I get a list of the odd numbers from 1 to 99. But now if I wanted to add > those number t

Re: [Tutor] OT What's next

2006-11-29 Thread R. Alan Monroe
> A couple of years ago, I took a course in which I built a rudimentary > computer around an Intel 8031 chip; and when I say "built," I mean built. > It was a couple dozen components on a breadboard, with about only about > 2Kbytes of memory, if I recall; I soldered or wire-wrapped every > conne

Re: [Tutor] Use Python to learn kids (9 yr) to program

2006-11-29 Thread R. Alan Monroe
> So my plan is to use Python, has anyone try to learn kids this way, and > could > giv som ide how-to. > I witch way to introduce every part of the language,,, http://davidbau.com/archives/2005/07/29/haaarg_world.html Alan ___ Tutor maillist - Tu

Re: [Tutor] OT What's next

2006-11-29 Thread R. Alan Monroe
> Pure assembler on a PC involves a huge amount of work for even > the most trivial task. Some useful assembly tips here: http://www.grc.com/smgassembly.htm Alan ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] move forward in arbitrary direction

2006-10-28 Thread R. Alan Monroe
> right now i can make something move up and down, or left and right, but > if I want to rotate a triangle, then move it so that the 'tip' always > points in the direction it's going to move, I get stuck. http://freespace.virgin.net/hugo.elias/routines/rotate.htm Alan

Re: [Tutor] How to save and later open text from a wxTextCtrl widget to a text file?

2006-10-16 Thread R. Alan Monroe
> I want to make a GUI in which user can write text in a text box and then > click a button to save it to a text file. I'm using wxPython's TextCtrl > widget. > Then later I would want the user to be able to open it back into that > window. > Any help appreciated, thank you. Have you learnt

Re: [Tutor] Tutor Digest, Vol 31, Issue 66

2006-09-23 Thread R. Alan Monroe
>> >> Message: 4 >> Date: Sat, 23 Sep 2006 08:38:37 +0100 >> From: "Alan Gauld" <[EMAIL PROTECTED]> >> Subject: Re: [Tutor] Fatal error after RE-installing Python 2.3.4 >> To: tutor@python.org >> Message-ID: <[EMAIL PROTECTED]> >> Content-Type: text/plain; format=flowed; charset="iso-8859-1"; >>

Re: [Tutor] python text adventures question

2006-09-17 Thread R. Alan Monroe
>>> I just ran into the following link; it's a tutorial on writing >>> adventure games (circa 1983): >>> >>>http://www.atariarchives.org/adventure >>> >>> Would anyone be interested in "porting" the examples over from BASIC to >>> Python? It might make a fun project for us here on Tutor; a

Re: [Tutor] How would I make a program that password protects on aninactivity timer?

2006-08-29 Thread R. Alan Monroe
> I'd try the screen saver settings first, its much easier! This is not Python specific, but very informative: http://www.codeproject.com/cpp/holsavers.asp Alan ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Query to the tutor mailing list

2006-08-24 Thread R. Alan Monroe
> On 8/24/06, John Fouhy <[EMAIL PROTECTED]> wrote: >> On 25/08/06, Joe Gamman <[EMAIL PROTECTED]> wrote: >> > Anyway, would appreciate any comments on the idea. >> >> It seems like the sort of thing you find in textbooks or "learn to >> program" books -- most books of this nature have suitable exe

Re: [Tutor] All of Kermit's E-Mails

2006-08-17 Thread R. Alan Monroe
> my email program does not insert the > sign like the standard email > program does. "The Bat" mail client does a great job of it, but it's not free. http://www.ritlabs.com/ You might try Pegasus Mail, although I don't remember how well it does it. http://www.pmail.com/ If you were desperate

Re: [Tutor] Python Block

2006-08-12 Thread R. Alan Monroe
> 5100- 3 > 5100 foo 1 > 5200 - 1 > 5200 foo 1 > I want to count the frequency of the second column of data that I can > access. It's kind of the long way around, but putting it into a sql database and doing a groupby query might work. Alan

Re: [Tutor] images in pygame

2006-07-23 Thread R. Alan Monroe
Dunno if this is the best way, but it works... Replace this: > if events.key == K_DOWN: with this: > if events.key == K_DOWN and not imagerect.colliderect(imagerects): Alan ___ Tutor maillist - Tutor@python.org http://mail.python.o

Re: [Tutor] help requested: port not free, under Windows XP

2006-05-24 Thread R. Alan Monroe
> Someone on edu-sig tried to get it working on her computer running Windows > XP home edition (just like mine, where it works fine!). However, she gets an > error message about > " port 8080 not free on local host." This is after she made sure nothing > else internet-related was working. [This

  1   2   >