Re: [Tutor] Tutor Digest, Vol 94, Issue 53

2011-12-15 Thread Alan Gauld

Please use a sensible subject line in future.

Pleae trim any excess material from the post, specifically do NOT post 
the entire digest to the list. We've already seen it!




On 15/12/11 02:15, rog capp wrote:

On Wed, Dec 14, 2011 at 6:03 PM,tutor-requ...@python.org  wrote:

Send Tutor mailing list submissions to
tutor@python.org

To subscribe or unsubscribe via the World Wide Web, visit
http://mail.python.org/mailman/listinfo/tutor
or, via email, send a message with subject or body 'help' to
tutor-requ...@python.org

You can reach the person managing the list at
tutor-ow...@python.org

When replying, please edit your Subject line so it is more specific
than Re: Contents of Tutor digest...


Today's Topics:


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

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


Re: [Tutor] Tutor Digest, Vol 94, Issue 53

2011-12-14 Thread rog capp
On Wed, Dec 14, 2011 at 6:03 PM,  tutor-requ...@python.org wrote:
 Send Tutor mailing list submissions to
        tutor@python.org

 To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.python.org/mailman/listinfo/tutor
 or, via email, send a message with subject or body 'help' to
        tutor-requ...@python.org

 You can reach the person managing the list at
        tutor-ow...@python.org

 When replying, please edit your Subject line so it is more specific
 than Re: Contents of Tutor digest...


 Today's Topics:

   1. Re: Tuple: Am I Understanding This Correctly? (Alan Gauld)
   2. ctype exceptions.ValueError for function call
      (Santhirakumaran, Gokul)
   3. while loops (rog capp)
   4. Re: while loops (Steven D'Aprano)
   5. Re: while loops (Dave Angel)


 --

 Message: 1
 Date: Wed, 14 Dec 2011 18:25:33 +
 From: Alan Gauld alan.ga...@btinternet.com
 To: tutor@python.org
 Subject: Re: [Tutor] Tuple: Am I Understanding This Correctly?
 Message-ID: jcapmt$7ed$1...@dough.gmane.org
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed

 On 14/12/11 15:48, Homme, James wrote:
  Am I explaining how this works correctly?

 You are not really explaining *how* it works, just saying what it does.
 What you are doing is sensible iff you have many places where the tuple
 is useful. In the specific case I'd personally just create the tuple at
 the point of use:

 finish = (user_name, prompt)
 likes = raw_input(Do you like me %s?\n%s % finish)

 likes = raw_input(Do you like me %s?\n%s % (user_name, prompt))

 Since it saves the reader referring back to the definition
 of finish (which is an odd nanme for user/prompt data IMHO).

 # Use the tuple repeatedly when asking other questions.

 But, if you are using the tuple repeatedly then it starts
 to make sense.

 --
 Alan G
 Author of the Learn to Program web site
 http://www.alan-g.me.uk/



 --

 Message: 2
 Date: Wed, 14 Dec 2011 21:15:38 +
 From: Santhirakumaran, Gokul
        gokul.santhirakuma...@christiedigital.com
 To: 'tutor@python.org' tutor@python.org
 Subject: [Tutor] ctype exceptions.ValueError for function call
 Message-ID:
        52784758373d504eb891cd133621a25b0aa51...@cktexmb01.cds.int
 Content-Type: text/plain; charset=us-ascii

 Hi,

 I'm trying to use a SDK(dll file) with python ctypes to take measurement from 
 a spectrometer. I some how got the deceive connected and took the measurement 
 , but when I try to call one of its calculation function I'm getting  the 
 exceptions.ValueError: Procedure probably called with not enough arguments 
 (8 bytes missing) error.

 I believe I have called the function with proper arguments and data types. I 
 would really appreciate some help.

 The Function:

 mydll = 
 ctypes.windll.LoadLibrary(D:\\WILD2\\tools\\WildVerification\\lib\\jeti_core.dll)
 device = ctypes.c_int()
 dvError = mydll.JETI_OpenDevice(0,ctypes.byref(device))

 X_value = ctypes.c_float()
 Y_value = ctypes.c_float()
 Z_value = ctypes.c_float()

 dvError = 
 mydll.JETI_CalcXYZ(device,ctypes.byref(X_value),ctypes.byref(Y_value),ctypes.byref(Z_value))

 Function Documentation:

 3.112 JETI_CalcXYZ
 This function returns the calculated tristimulus XYZ.
 3.112.1 Prototype
 DWORD JETI_CalcXYZ (DWORD dwDevice, FLOAT *fX, FLOAT *fY, FLOAT *fZ)
 3.112.2 Parameters
 Input
 Name               Type                             Description               
                Call
 dwDevice          DWORD                       Handle to a device as           
      By value
 returned by
 JETI_OpenDevice

 fX                     FLOAT*                         pointer to a variable   
                 By reference
 where the tristimulus X
 will be stored

 fY                     FLOAT *                        pointer to a variable   
                 By reference
 where the tristimulus Y
 will be stored

 fZ                     FLOAT *                        pointer to a variable   
                 By reference
 where the tristimulus Z
 will be stored

 -
 Gokul Santhirakumaran
 Electrical Engineer(Co-op)

 CHRISTIE
 809 Wellington St. N.
 Kitchener, ON, Canada N2G 4Y7
 PH: +1 519-744-8005 x7313
 www.christiedigital.comhttp://www.christiedigital.com

 -- next part --
 An HTML attachment was scrubbed...
 URL: 
 http://mail.python.org/pipermail/tutor/attachments/20111214/7b01e759/attachment-0001.html

 --

 Message: 3
 Date: Wed, 14 Dec 2011 17:41:24 -0500
 From: rog capp beetleb...@gmail.com
 To: tutor@python.org
 Subject: [Tutor] while loops
 Message-ID:
        CAKP55S=jes4fcocy7hxi_dng2ywsf2mkeqz_9qzztf63edh...@mail.gmail.com
 Content-Type: text/plain; charset=ISO-8859-1

 # Guess my number
 #
 # The computer picks a random number between 1 and 100
 # The player tries to guess it and the computer lets
 # the player know  if the guess is to high, to low
 # or right on 

Re: [Tutor] Tutor Digest, Vol 94, Issue 53

2011-12-14 Thread Prasad, Ramit
snip

 End of Tutor Digest, Vol 94, Issue 53
 *
while  guess != the_number and tries  5:
if guess  the_number:
print(Lower...)
else:
print(Higher...)
guess = int(input(Take a guess: ))
tries += 1
if guess == the_number:
print(good job the number was,  , the_number)
print(it took you , tries, tries.)
else:
print(Sorry you took to many tries)
THANKS Steve and Dave got it working now.
roGca
===
Please reply and change the digest subject to the
original subject or relevant subject if new. While
you did an excellent job not top-posting it would
also be good if you trimmed out the irrelevant
sections from your reply.

Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor