Re: [Tutor] Urgent Help Required

2012-02-04 Thread Dave Angel

On 02/04/2012 08:17 AM, Zafrullah Syed wrote:

Hi,

I need urgent help:

I am unable to commit code to svn, I am getting this warning:

*svn: Commit failed (details follow):*
*svn: Commit blocked by pre-commit hook (exit code 1) with output:*
*:17: Warning: 'with' will become a reserved keyword in Python 2.6*
*writeConf.py:17: invalid syntax*
*Commited Python-Files refused, please check and retry...*

How do i surpass this and commit my code??

Lousy choice of subject.  Please make your subject reflect what your 
problem is, not how important it may or may not be to you.


You're not just running svn.  If you were, you'd not get some python 
error or warning.  So you're running a more complex environment, perhaps 
svn integrated inside some IDE (like komodo, wingware, beans, whatever).


If so, post a question on the forum that supports that particular IDE.  
Or if you must post here, at least give us a clue what environment 
you're using.  For example, i can infer that you're running Python 2.5 
or older.  But it'd be much better to explicitly say what python 
version, which operating system (and version), and what IDE (and 
version), and what svn (get the pattern?).


The svn command to submit changes to a file outside of the ide is  svn 
commit filename.  If the file is new, I believe you have to do an svn add.




--

DaveA

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


[Tutor] Urgent Help Required

2012-02-04 Thread Zafrullah Syed
Hi,

I need urgent help:

I am unable to commit code to svn, I am getting this warning:

*svn: Commit failed (details follow):*
*svn: Commit blocked by pre-commit hook (exit code 1) with output:*
*:17: Warning: 'with' will become a reserved keyword in Python 2.6*
*writeConf.py:17: invalid syntax*
*Commited Python-Files refused, please check and retry...*

How do i surpass this and commit my code??

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


Re: [Tutor] urgent help!!!!!!!!!!!

2011-11-18 Thread Emile van Sebille

On 11/17/2011 3:26 PM ADRIAN KELLY said...

i know i'm stupid but i have tried everything to get one line of text
working, i have written out pseudo and read every website.
now i am getting this error

Traceback (most recent call last):
File "F:\VTOS ATHLONE\PYTHON_VTOS\foreign exchange\f_ex4 - Copy.py",
line 24, in 
main()
File "F:\VTOS ATHLONE\PYTHON_VTOS\foreign exchange\f_ex4 - Copy.py",
line 14, in main
while amount<50:
UnboundLocalError: local variable 'amount' referenced before assignment




You've seen the fixes, but perhaps more explanation helps too.

Python organizes variables into namespaces.  The normal namespace 
resolution sequence is local, global, builtin.  Assigning to a name 
within a function creates a local variable, otherwise accessing a name 
in a function will use the global or builtin namespaces.  Python decides 
these issues in part during initial loading of the module where it sees 
that you assign to the variable amount within the function, thus 
creating a local variable.  Later, during execution, you first test the 
value of amount (in the while statement), but amount isn't assigned to 
until after the test, ergo, UnboundLocalError.


HTH,

Emile



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


Re: [Tutor] urgent help!!!!!!!!!!!

2011-11-17 Thread Prasad, Ramit
def exchange(cash_in):
    euro=1
    dollar=1.35
    base=50
    if cash_in>base:
        totalreturn=cash_in*dollar
    else:
        totalreturn=0
    return totalreturn

amount=0
# this would be better placed inside the main function.
def main():
    while amount<50:
        amount = raw_input(float('how much do you want to change:'))
# This should be 
# amount = float( raw_input('how much do you want to change:' ) )
    if amount<50:
        total=0
        print 'enter an amount over 50: '
    else:
        total=exchange(amount)
        print 'Your exchange comes to: ',total


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


Re: [Tutor] urgent help!!!!!!!!!!!

2011-11-17 Thread Alex Hall
My mail client stripped new lines, at least on this machine, so I will
just top-post this. Sorry!
Your problem is that you say:
amount=0
def main()...
You then try to use amount in main, but main has no amount in it.
Either move "amount=0" inside main, or put a global reference:
amount=0
def main():
global amount
...

On 11/17/11, ADRIAN KELLY  wrote:
>
> i know i'm stupid but i have tried everything to get one line of text
> working, i have written out pseudo and read every website.now i am
> getting this error
> Traceback (most recent call last):  File "F:\VTOS
> ATHLONE\PYTHON_VTOS\foreign exchange\f_ex4 - Copy.py", line 24, in 
>   main()  File "F:\VTOS ATHLONE\PYTHON_VTOS\foreign exchange\f_ex4 -
> Copy.py", line 14, in mainwhile amount<50:UnboundLocalError: local
> variable 'amount' referenced before assignment>>>
>
>
> def exchange(cash_in):euro=1dollar=1.35base=50if
> cash_in>base:totalreturn=cash_in*dollarelse:
> totalreturn=0return totalreturn
> amount=0def main():while amount<50:amount = raw_input(float('how
> much do you want to change:'))if amount<50:total=0print
> 'enter an amount over 50: 'else:total=exchange(amount)
> print 'Your exchange comes to: ',total
>
>
>
>
> Adrian Kelly
> 1 Bramble Close
>
> Baylough
>
> Athlone
>
> County Westmeath
>
> 0879495663
>
>
> From: waynejwer...@gmail.com
> Date: Thu, 17 Nov 2011 16:53:59 -0600
> Subject: Re: [Tutor] please help - stuck for hours
> To: kellyadr...@hotmail.com
> CC: tutor@python.org
>
> On Thu, Nov 17, 2011 at 4:32 PM, ADRIAN KELLY 
> wrote:
>
>
>
>
>
>
>
>
> thanks very much, great response really really appreciated it and now i
> understand. i hate to ask again but can you see why it won't print the
> 'enter and amount over 50' in the right place??
>
>
> Computers are unfailingly stupid machines. They will do whatever wrong thing
> you tell them to do every single time.
>
>  def main():amount=0while amount<50:amount =
> input('how much do you want to change:')
>
> print 'enter an amount over €50: 'else:
> total=exchange(amount)print 'Your exchange comes to: ',total
>
>
> Sometimes it helps writing out the logic in steps before you translate it to
> code. In this case my guess is that these are the steps you want:
>   1. Get a value from the user (you're still using input - stop that, it's
> dangerous! input is   only a good function in 3.x where it replaces
> raw_input)
>
>2. If the value is less than 50, tell the user to enter an amount > 50
> and repeat step 1
>   3. Otherwise, exchange the amount and display that.
> Right now, these are the steps that you're doing:
>
>
>   1. Get a value from the user
>   2. Display the error message
>   3. If the value is < 50, go to 1
>   4. exchange the amount
>
>
>   5. display the amount.
> HTH,Wayne 


-- 
Have a great day,
Alex (msg sent from GMail website)
mehg...@gmail.com; http://www.facebook.com/mehgcap
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] urgent help!!!!!!!!!!!

2011-11-17 Thread ADRIAN KELLY

i know i'm stupid but i have tried everything to get one line of text working, 
i have written out pseudo and read every website.now i am getting this 
error
Traceback (most recent call last):  File "F:\VTOS ATHLONE\PYTHON_VTOS\foreign 
exchange\f_ex4 - Copy.py", line 24, in main()  File "F:\VTOS 
ATHLONE\PYTHON_VTOS\foreign exchange\f_ex4 - Copy.py", line 14, in main
while amount<50:UnboundLocalError: local variable 'amount' referenced before 
assignment>>> 


def exchange(cash_in):euro=1dollar=1.35base=50if cash_in>base:  
  totalreturn=cash_in*dollarelse:totalreturn=0return 
totalreturn
amount=0def main():while amount<50:amount = raw_input(float('how 
much do you want to change:'))if amount<50:total=0print 
'enter an amount over 50: 'else:total=exchange(amount)print 
'Your exchange comes to: ',total
 

  

Adrian Kelly 
1 Bramble Close

Baylough

Athlone

County Westmeath

0879495663


From: waynejwer...@gmail.com
Date: Thu, 17 Nov 2011 16:53:59 -0600
Subject: Re: [Tutor] please help - stuck for hours
To: kellyadr...@hotmail.com
CC: tutor@python.org

On Thu, Nov 17, 2011 at 4:32 PM, ADRIAN KELLY  wrote:








thanks very much, great response really really appreciated it and now i 
understand. i hate to ask again but can you see why it won't print the  'enter 
and amount over 50' in the right place??


Computers are unfailingly stupid machines. They will do whatever wrong thing 
you tell them to do every single time. 

 def main():amount=0while amount<50:amount = input('how 
much do you want to change:')

print 'enter an amount over €50: 'else:
total=exchange(amount)print 'Your exchange comes to: ',total


Sometimes it helps writing out the logic in steps before you translate it to 
code. In this case my guess is that these are the steps you want:
  1. Get a value from the user (you're still using input - stop that, it's 
dangerous! input is   only a good function in 3.x where it replaces raw_input)

   2. If the value is less than 50, tell the user to enter an amount > 50 and 
repeat step 1
  3. Otherwise, exchange the amount and display that.
Right now, these are the steps that you're doing:


  1. Get a value from the user
  2. Display the error message
  3. If the value is < 50, go to 1
  4. exchange the amount


  5. display the amount.
HTH,Wayne ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] urgent help required! invalid syntax

2011-02-18 Thread James Reynolds
There's a few things I've noticed:

1. I would recommend using an IDE of some sort. I copy and pasted this into
eclipse, and it told me straight away that you had a parenthesis problem on
this line: d1=(log(s/x)+((r+v**2/2)*t)/(v*sqrt(t))

2. Your function "dividend" isn't returning a value.

3. Unless there is more to the program that you haven't shown us, all of the
math stuff that I can see, such as sqrt, pi, log, exp and possibly others
I'm not thinking of should be prefixed with math..

4. The function BS isn't returning anything.

5. Lastly, if you are a familiar with object oriented programing, the black
scholes is better suited towards OOP.

2011/2/18 lim chee siong 

>
>
> Hi,
>
> I was writing a module for the black-scholes pricing model in python, but I
> keep getting this error message:
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "C:\Python26\lib\blackscholes.py", line 25
> d2=d1-v*sqrt(t)
>
>
> This is the code in my blackscholes.py file:
> #Black-Scholes model
>
> import math
> import numpy
> import scipy
>
> #Cumulative normal distribution
>
> def CND(x):
>
>   
> (a1,a2,a3,a4,a5)=(0.31938153,-0.356563782,1.781477937,-1.821255978,1.330274429)
>   L=abs(x)
>   K=1.0/(1.0+0.2316419*L)
>   
> w=1.0-1.0/sqrt(2*pi)*exp(-L*L/2)*(a1*K+a2*K*K+a3*pow(K,3)+a4*pow(K,4)+a5*pow(K,
> 5))
>   if x<0:
> w=1.0-w
>   return w
>
> #s: price of underlying stockx:strike price
> #r: continuously compounded risk free interest rate
> #t: time in years until expiration of option
> #v: implied volatility of underlying stock
>
> def dividend(s,x,r,t,v):
>   d1=(log(s/x)+((r+v**2/2)*t)/(v*sqrt(t))
>   d2=d1-v*sqrt(t)
>
> def BS(s,x,r,t,v):
>   c=s*CND(d1)-x*exp(-r*t)*CND(d2)
>   p=x*exp(-r*t)*CND(-d2)-s*CND(-d1)
>   delta=CND(d1)-1
>   gamma=CND(d1)/(s*v*sqrt(t))
>   vega=s*CND(d1)*sqrt(t)
>   theta=-((s*CND(d1)*v)/(2*sqrt(t))+r*x*exp(-r*t)*CND(-d2)
>   rho=-x*t*exp(-r*t)*CND(-d2)
>
>
> What is wrong here? What do I need to change? Thanks! Quick reply will be
> much appreciated because the deadline is tomorrow!
>
>
> ___
> 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


Re: [Tutor] urgent help required! invalid syntax

2011-02-18 Thread Steven D'Aprano
lim chee siong wrote:
> 
> 
> Hi,
> I was writing a module for the black-scholes pricing model in python, but I 
> keep getting this error message: 
> Traceback (most recent call last):  File "", line 1, in   File 
> "C:\Python26\lib\blackscholes.py", line 25d2=d1-v*sqrt(t) 


Please COPY AND PASTE the FULL error message, including the entire
traceback. Do not re-type it, summarise it, simplify it, or change it in
any other way.

But my guess is that you're probably missing a closing bracket ) on that
line, or the one before it.



-- 
Steven

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


[Tutor] urgent help required! invalid syntax

2011-02-18 Thread lim chee siong



Hi,
I was writing a module for the black-scholes pricing model in python, but I 
keep getting this error message: 
Traceback (most recent call last):  File "", line 1, in   File 
"C:\Python26\lib\blackscholes.py", line 25d2=d1-v*sqrt(t) 
This is the code in my blackscholes.py file:#Black-Scholes model
import mathimport numpyimport scipy
#Cumulative normal distribution
def CND(x):  
(a1,a2,a3,a4,a5)=(0.31938153,-0.356563782,1.781477937,-1.821255978,1.330274429) 
 L=abs(x)  K=1.0/(1.0+0.2316419*L)  
w=1.0-1.0/sqrt(2*pi)*exp(-L*L/2)*(a1*K+a2*K*K+a3*pow(K,3)+a4*pow(K,4)+a5*pow(K,5))
  if x<0:w=1.0-w  return w
#s: price of underlying stockx:strike price#r: continuously compounded risk 
free interest rate#t: time in years until expiration of option#v: implied 
volatility of underlying stock
def dividend(s,x,r,t,v):  d1=(log(s/x)+((r+v**2/2)*t)/(v*sqrt(t))  
d2=d1-v*sqrt(t)
def BS(s,x,r,t,v):  c=s*CND(d1)-x*exp(-r*t)*CND(d2)  
p=x*exp(-r*t)*CND(-d2)-s*CND(-d1)  delta=CND(d1)-1  gamma=CND(d1)/(s*v*sqrt(t)) 
 vega=s*CND(d1)*sqrt(t)  
theta=-((s*CND(d1)*v)/(2*sqrt(t))+r*x*exp(-r*t)*CND(-d2)  
rho=-x*t*exp(-r*t)*CND(-d2)

What is wrong here? What do I need to change? Thanks! Quick reply will be much 
appreciated because the deadline is tomorrow!
  ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] urgent help required! invalid syntax

2011-02-18 Thread Timo
On 18-02-11 09:42, lim chee siong wrote:
>
>
> Hi,
>
> I was writing a module for the black-scholes pricing model in python,
> but I keep getting this error message:
>
> Traceback (most recent call last):
> File "", line 1, in 
> File "C:\Python26\lib\blackscholes.py", line 25
> d2=d1-v*sqrt(t)
That's not the whole traceback, is it?

>
> This is the code in my blackscholes.py file:
> #Black-Scholes model
>
> [snip]
>
> def dividend(s,x,r,t,v):
> d1=(log(s/x)+((r+v**2/2)*t)/(v*sqrt(t))
> d2=d1-v*sqrt(t)
>
> [snip]
>
>
> What is wrong here? What do I need to change?
Check the line before the line which throws a syntax error. Have a good
look at it and you will see you are missing a character.

Cheers,
Timo

> Thanks! Quick reply will be much appreciated because the deadline is
> tomorrow!
>
>
> ___
> 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


Re: [Tutor] Urgent: Help

2008-01-07 Thread bob gailer
Please reply to the list not just me. We all participate and learn.

Shumail Siddiqui wrote:
> I know this assignment is not too hard, but I have been greatly 
> overwhelmed with work as I have been taking a 19 credits recently. I 
> kind of have an approach to this by importing random numbers and 
> random.choice leaves the first four numbers as a result. But, I don't 
> know how to add these numbers in the program, 
One approach is:

start with a total of 0
add the first number to the total
if the total does not reach the goal
add the next number
etc.

That can be implemented in a loop.

Give it a try and show us how far you can come.

> while I know that I can use append to add those scores.
I don't know how to use append to add

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


[Tutor] Urgent: Help

2008-01-07 Thread Michael H. Goldwasser

Very good questions indeed.  Also familiar ones to me. The first is
Exercise 5.28 and the second is Exercise 5.23 from the text book
"Object-Oriented Programming in Python."

Alan's advice was very sound, but I strongly recommend that you work
with your instructor in guiding you through these problems.  He or she
is best qualified to know your current level and the context for such
a homework assignment. Of course, reading the book is also likely to
help.

For everyone else, if you like these exercises there are 300 more
where they came from.  ;-)

With regard,
Michael

   +---
   | Michael Goldwasser
   | Associate Professor
   | Dept. Mathematics and Computer Science
   | Saint Louis University
   | 220 North Grand Blvd.
   | St. Louis, MO 63103-2007



On Sunday January 6, 2008, Shumail Siddiqui wrote: 

>   Investment Thresholds   
>
>  Define a Python function threshold(dailyGains, goal) that behaves as 
> follows. The first parameter is a list of integers that represent the daily 
> gains in the value of a stock. The second paramter is a single positive 
> number that is a profit goal. The function should return the minimum number 
> of days for which the stock should be owned in order to achieve a profit that 
> is equal to or greater than the stated goal. If the goal is unreachable, the 
> function should return 0.   
>For example,   
>threshold ([5, 3, 8, 2, 9, 1], 17)   
>should return 4 because the goal (17) can be reached after the first four 
> days (e.g., 5 + 3 + 8 + 2).   
>  
>  Write a small Python program that uses your threshold() function to 
> demonstrate that it works correctly. Your program may use a pre-defined list 
> of stock gains or it may generate one randomly (see the "Helpful Hints" 
> section below for tips on how to do this). Your program should display this 
> list, prompt the user to enter a profit goal, and then print out the total 
> number of days required to reach that goal (or a message stating that the 
> goal is impossible).   


>   Word Windows   
>
>  Define a Python function sliding(word, num) that behaves as follows. 
> It should print out each num-length slice of the original word , aligned 
> vertically as shown below.   
>For example, a call to sliding("examples", 4) should produce the output   
>
>exam   xampampl mple  ples  
>  
>  
>  Write a small Python program to demonstrate that your sliding() 
> function works correctly. Your program should prompt the user to enter a word 
> and a window size, and then call sliding() with those values.   


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


Re: [Tutor] Urgent: Help

2008-01-07 Thread bob gailer
Shumail Siddiqui wrote:
> Dear tutor,
>  I have a question regarding a functions based assignment.
I agree with Alan.

And I wonder why this assignment is hard for you.

Are you in the wrong course (insufficient prerequisites)?

Is the instructor failing to provide the resources you need?

Are you overwhelmed with life and struggling to get through?

Or do you just want to get a passing grade and don't care about learning 
programming and Python?

It might help us if we understood why you are seeking help.

Bob


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


Re: [Tutor] Urgent: Help

2008-01-07 Thread Alan Gauld
"Shumail Siddiqui" <[EMAIL PROTECTED]> wrote

>   I have a question regarding a functions based assignment. The 
> assignment is:
>  For this project, you will write two small Python programs:
>

OK, Since this is for homework I cannot give you the answers
but I will point out some things you shouild look at and an approach.


>   Investment Thresholds
>
>  Define a Python function threshold(dailyGains, goal) that 
> behaves as follows.

First define the function and test it using the >>> prompt.

>  Write a small Python program that uses your threshold() 
> function
> to demonstrate that it works correctly. Your program may use a
> pre-defined list of stock gains or it may generate one randomly

Use a predefined list initially, it's easier!
Only once that works try introducing random elements.

>   Word Windows

One problem at a time...

>  This is what I have so far:
>
>  import random
> dailyGains = int(random.range(6))
> goal = random.choice(range(4)

missing parenthesis, I assume a typo?

> result = []
> def threshold(dailyGains, goal):
>  if goal!= result: 0
>  else:
>result.reverse()
>result.remove()

you need to investigate the return statement in functions.

However I don;t understand how you think this will
achieve anything like what the original specification
asked for. You need to use the dailyGains list
somewhere... And why you are checking against
result I don't know.

Can you describe in English what the function should
do and how you would go about it manually using
pen and paper? Can you translate that process to
Python?

>  As you can see I am having a great problem.

It looks like the normal learning process to me :-)
Just take your time, solve one bit at a time and
build on your previous work. If you get stuck come
back here and ask specific questions and show
us what you have done.

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 


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


[Tutor] Urgent: Help

2008-01-07 Thread Shumail Siddiqui
Dear tutor, 
   I have a question regarding a functions based assignment. The assignment 
is:
  For this project, you will write two small Python programs: 
  

   Investment Thresholds   

  Define a Python function threshold(dailyGains, goal) that behaves as 
follows. The first parameter is a list of integers that represent the daily 
gains in the value of a stock. The second paramter is a single positive number 
that is a profit goal. The function should return the minimum number of days 
for which the stock should be owned in order to achieve a profit that is equal 
to or greater than the stated goal. If the goal is unreachable, the function 
should return 0.   
For example,   
threshold ([5, 3, 8, 2, 9, 1], 17)   
should return 4 because the goal (17) can be reached after the first four days 
(e.g., 5 + 3 + 8 + 2).   
  
  Write a small Python program that uses your threshold() function to 
demonstrate that it works correctly. Your program may use a pre-defined list of 
stock gains or it may generate one randomly (see the "Helpful Hints" section 
below for tips on how to do this). Your program should display this list, 
prompt the user to enter a profit goal, and then print out the total number of 
days required to reach that goal (or a message stating that the goal is 
impossible).   

  
  
   Word Windows   

  Define a Python function sliding(word, num) that behaves as follows. It 
should print out each num-length slice of the original word , aligned 
vertically as shown below.   
For example, a call to sliding("examples", 4) should produce the output   

exam   xampampl mple  ples  
  
  
  Write a small Python program to demonstrate that your sliding() function 
works correctly. Your program should prompt the user to enter a word and a 
window size, and then call sliding() with those values.   


  
  Helpful Hints  
   Python contains a set of facilities to handle random number generation. Full 
details are available at http://docs.python.org/lib/module-random.html. A quick 
summary is as follows:   

  Add the statement   
import random   
at the beginning of your program source code. This tells Python where to find 
the code that describes how to generate random values.   
  
  Pass your list of values to the random.choice() function. The function 
will return a single randomly-selected element from that list.   
For example, random.choice(range(5)) will return a random value in the range 
0-4.   
Please note that "random" does not necessarily mean "unique"; sequential calls 
to this function may return the same answer, because it is randomly chosen each 
time! 


  This is what I have so far:
   
  import random
dailyGains = int(random.range(6))
goal = random.choice(range(4)
result = []
def threshold(dailyGains, goal):
  if goal!= result: 0
  else:
result.reverse()
result.remove()
   
  As you can see I am having a great problem.


   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor