Re: [Tutor] Invitation to connect on LinkedIn

2009-09-15 Thread Michael Connors
Gmail adds everyone you mail to your address book, and sites like LinkedIn
ask for your email account credentials to search for contacts from your
address book. I think this could happen to anyone who is unfamiliar with
either service.
Michael

2009/9/15 Kent Johnson ken...@tds.net

 I'm going to be charitable and assume this is a mistake. This is completely
 inappropriate to post to the tutor list.

 Kent

 On Tue, Sep 15, 2009 at 6:50 AM, Govind Agrawal govindgo...@gmail.comwrote:

   LinkedIn

 I'd like to add you to my professional network on LinkedIn.

 - Govind

 Accept Govind Agrawal's invite:
 https://www.linkedin.com/e/isd/738276939/KwugpKmr/

 © 2009, LinkedIn Corporation

 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor



 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor




-- 
Michael Connors
Burggravenlaan 148,
Leiden 2313 HZ,
The Netherlands

0031611520252
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Pyduino

2009-09-08 Thread Michael Connors



 You wouldn't want to run python on a 16 mhz processor, the interpreter
 would use up all your resources. The Arduino language is not too hard
 to learn.




I have followed some tutorials in the Arduino playground, for talking to the
arduino from Python. You can do things like tell your LED to turn on and off
based on a key press on your computers keyboard, and from there you can
probably figure out how to do plenty of other things.

The coding for the Arduino is still done in the native language, but the
client you use to speak to the connected arduino would be written in Python.

-- 
Michael Connors
Leiden
The Netherlands
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] noob question (Windows, Python 3.1)

2009-08-06 Thread Michael Connors
2009/8/6 Joshua Harper joshharpe...@gmail.com

 Ok, so I am trying to learn python, and I am reading many tutorial type
 things and I am kind of stuck with implementing some of the code... so for
 example the tutorial says *To get the examples working properly, write
 the programs in a text file and then run that with the interpreter*
 Alright...simple enough so I wirte the example program:

 x = input(Please enter a number: )
 print The square of that number is

 I save this as a .py and Open Withpython.exe. OK, so that gives me the
 terminal ansking me to enter a number, I enter a number and click enter and
 then it prints in like half a nanosecond and the cmd line window closes. I
 want to know how to have the window stay open so that, in future scripts I
 may be able to actually see what was printed. I talked to my friend and he
 said that he has the same problem...anybody?...help???


It closes because it is finished.

If you want to see the result, you could either:

- Place another input() after the print statement.
- Run the program from the command prompt (in which case you will probably
need to set the path)

-- 
Michael Connors
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best Python Editor

2009-06-15 Thread Michael Connors
Back when I used Windows I used this: http://www.crimsoneditor.com/

I think its not being developed anymore, but it is a great editor/IDE that
supports many languages.

-- 
Michael Connors
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (no subject)

2009-03-17 Thread Michael Connors
So the extent of your effort is Would anyone know how to Ctrl+c.
That deserves an award.

2009/3/17 Jared White dukelx2...@gmail.com

 Would anyone know how to Write an application that displays the following
 patterns separately, one below the other. Use for or while loops to generate
 the patterns. All asterisks (*) should be printed by a single statement of
 print( '*' ); which causes the asterisks to print side by side. A statement
 of println(\n); can be used to move to the next line.
 *
 **
 ***
 
 *
 **
 ***
 
 *
 **

 **
 *
 
 ***
 **
 *
 
 ***
 **
 *
 dukelx2...@gmail.com

 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor




-- 
Michael Connors
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Question

2008-11-10 Thread Michael Connors
2008/11/10 W W [EMAIL PROTECTED]

 On Mon, Nov 10, 2008 at 9:40 AM, Alan Gauld [EMAIL PROTECTED]wrote:

 snip

 What does nano do that vi (or emacs) doesn't? Given that vi is the
 standard editor on *nix ity would seem the obvious choice. But everyone
 seems to be using nano? Why?


 AFAIK, it's a little smaller/faster than emacs... but since I'm a vi(m)
 fan, I'm probably the wrong person for the question ;)



My guess is that, if you want to provide instructions to someone with no
linux/unix experience. e.g. to edit a config file, you can safely tell them
to: nano myfile.conf and expect them to be able to save the file and return
to the command line. If you want to give the same instructions using vim or
emacs, you would also need to specify how to save and exit. I imagine this
to be the reason it is popular in tutorials, and if all the tutorials you
use, use nano, you will probably use it too.

-- 
Michael Connors
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Table like array in Python

2008-03-26 Thread Michael Connors
On 26/03/2008, Gloom Demon [EMAIL PROTECTED] wrote:

 Hello :-)

 Example (cost of something in different countries by different years)

 Record1 US 2006 22.10
 Record2 US 2007 23.45
 Record3 UK 2007 22.90
 ..
 http://mail.python.org/mailman/listinfo/tutor


In Python a list is similiar to an array in Pascal.
You define a list like this: my_list = [1, 2, 3, 4]

However I dont think you want an array here, if I was doing something like
this I would use a dictionary. A dictionary stores keys and values.
So you could do something like this:

records = {'US': {'2007': 22.5, '2008': 44.8}, 'UK': {'2008': 3.4, '2007':
2.6}}

You can now access a particular record as follows:

In: print records['UK']['2007']
Out: 2.6

Regards,
-- 
Michael Connors
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] decimal precision

2008-03-25 Thread Michael Connors
On 25/03/2008, elis aeris [EMAIL PROTECTED] wrote:

 x = 53
 w = 192
 for a in range ( x, (x+192) ):
 print (a-x)/w


 the problem is at (a-x)/w

 it's supposed to return a ratio between x and w, yet it 0 all the time.

 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor



I think to do float division the operands should be floats.
So if you do:

print float(a-x) / float(w)

It should produce a floating point result.

-- 
Michael Connors
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] decimal precision

2008-03-25 Thread Michael Connors
On 25/03/2008, elis aeris [EMAIL PROTECTED] wrote:

 x = 53
 w = 192
 for a in range ( x, (x+192) ):
 print (a-x)/w


 the problem is at (a-x)/w

 it's supposed to return a ratio between x and w, yet it 0 all the time.

 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor



I think to do float division the operands should be floats.
So if you do:

print float(a-x) / float(w)

It should produce a floating point result.

-- 
Michael Connors
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] decimal precision

2008-03-25 Thread Michael Connors
On 25/03/2008, elis aeris [EMAIL PROTECTED] wrote:

 what if i want it only to 2nd decimal?

 what if i want to cut off everything behind decimal?



In: print %.2f % (0.99)
Out: 0.99

http://docs.python.org/lib/typesseq-strings.html
-- 
Michael Connors
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Problem with while loop

2007-09-10 Thread Michael Connors
Hi,
I would do it as follows, adding 0s to front to make them valid PINs.

while counter  howmany:

pin = randint(,)
print %04i % (pin)
counter += 1

On 10/09/2007, Vishnu Mohan [EMAIL PROTECTED] wrote:


  Now I just need to figure out how to only get 4 digit pin numbers :)
 
 Use regular expressions
 The following is the code with re.


 from random import randint
 import re

 counter = 0
 pinPattern = re.compile(r'^\d{4}$')
 howmany = raw_input( How many:  )
 if pinPattern.match(howmany):
 while counter  int(howmany):
 pin = randint(,)
 print pin
 counter += 1
 else:
 print %s is not valid 4 digit integer%howmany


 -vishnuMohan




-- 
Michael Connors
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Problem with while loop

2007-09-07 Thread Michael Connors
You could use string formatting to output all pin numbers as 4 character
strings.

http://docs.python.org/lib/typesseq-strings.html

On 07/09/2007, matte [EMAIL PROTECTED] wrote:

 Perfect...

 Thanks very much for your help...

 On 9/7/07, Michael Connors [EMAIL PROTECTED] wrote:
 
  I think it will work if you cast your input to an int:
  howmany = int(raw_input( How many:  ))


 Now I just need to figure out how to only get 4 digit pin numbers :)

 -m




-- 
Michael Connors
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Problem with while loop

2007-09-07 Thread Michael Connors
I think it will work if you cast your input to an int:
howmany = int(raw_input( How many:  ))

On 07/09/2007, matte [EMAIL PROTECTED] wrote:

 Hi guys

 Please excuse me but I've been out of Python for a while since my laptop
 was stolen...

 I'm battling with a very basic while loop

 -- 8 --
 #!/usr/bin/python

 from random import randint

 counter = 0

 howmany = raw_input( How many:  )

 while counter  howmany:

 pin = randint(,)
 print pin
 counter += 1

 -- 8 --

 For some reason if I use an integer in place of howmany it works, but
 I'd
 like it to work as I can logically see it above.

 What am I missing ?

 -m

 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor




-- 
Michael Connors
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python / CGI

2007-09-06 Thread Michael Connors
Hi,
If you have your own server to run it on, I think it would make sense to use
one of the Python web frameworks that are out there. I used cherrypy for my
first web-based python project and I found it very easy to learn and develop
in quickly.
Regards,
Michael

On 06/09/07, Fiyawerx [EMAIL PROTECTED] wrote:

 Hi guys, quick question, I've been trying to learn python lately, and have
 written a few little apps to help with some day to day stuff I do, and
 recently my fiance asked me if it was possible to come up with a simple web
 based schedule she can use with the other teachers in her school to schedule
 library time. (She's the librarian). Basically, it will be a small calendar
 like app that will have 'slots' teachers can sign up for. It doesn't sound
 like it would be too complicated, and may be a good learning project. I was
 wondering if python as cgi would be good for this, and if there are any
 pitfalls I need to watch out for before I start delving into it. I'm also
 fairly new to writing my own html so will basically be learning it all from
 scratch.

 TIA,
  Lee McClintock

 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor




-- 
Michael Connors
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] python syntax: underscore

2007-07-12 Thread Michael Connors

Hi,
I was following the thread on about the _(xx) thingy.
Since then I played around a bit with underscores at the console and it
seems to me that if you execute code with a return value but you dont save
the result, then  _ is a pointer to this value.

Is that correct?


4

4

print _

4

So if I do this,

_ = 10



4

4

print _

10

What is this _ used for?
If I assign something to the underscore, will it cause strange things to
happen later?
(Just curiosity)
Regards,
--
Michael
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How can I escape a pound symbol in my script?

2007-07-06 Thread Michael Connors

And this is really off-topic now! :-)
Really interesting though, hopefully it will come up in a pub quiz.

On 06/07/07, Alan Gauld [EMAIL PROTECTED] wrote:


Kent Johnson [EMAIL PROTECTED] wrote

  is of course an historical feature of old keyboards
  when, to get a hash symbol (#), you had to type a
  pound sign(£), ie shift 3.

 That is a very interesting explanation but I prefer this one:

http://en.wikipedia.org/wiki/Number_sign#Naming_convention_within_the_USA

 # is an abbreviation for 'pound' the weight, not 'pound' the unit
 of currency.

Interesting indeed. I got my explanation in high school around 1972.
It went like this
The pound and the dollar were the main currencies in use when
Remington
introduced the QWERTY keyboard on their early typewriters. The pound
sign
was Shift-3 and the dollar shift-4. When the US introduced the #
symbol
(in the early 1920's?) to keyboards they used the pound sign position
(because the pound had decreased in usage by then) and the symbol
was called the pound sign because that was what was traditionally on
the key used.

The symbol is called hash is the UK because its derived from
the more term cross-hatch, where the symbol is like the cross
hatching used for shading when sketching, which in turn is often
called hatching.

And that was part of our Modern History class and was examinable! :-)

An alternative explanation for hash that I've seen is that it relates
to cooking where a hash is a meal composed of ingredients cut
into cubes and the symbol is remminiscent of the cut lines made
when cubing (or hashing) the meat etc.

 Of course the correct name for this symbol is 'octothorpe' :-)
 http://en.wiktionary.org/wiki/Octothorpe

That I would query, the article says the Bell labs folks claim to have
coined
the term in 1964 but the symbol has been in use for at least a hundred
years. Although whether it had an official name up till then I don't
know... In fact the name most likely I'd have thought would be sharp
as in music notation, which is where, I think, it originated.

And this is really off-topic now! :-)

Alan G.


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor





--
Michael Connors
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor