Re: [Tutor] BMI calc

2013-03-12 Thread Jos Kerc
Hi, On Wed, Mar 13, 2013 at 4:07 AM, Soliman, Yasmin wrote: > I'm using python 2.7, where exactly does the return statment with the > (return (weight/(height*height))*703 calculation get posted in the function? > > def calc_BMI(weight,height): > if bmi <=18.5: > return 'underweight'

Re: [Tutor] BMI calc

2013-03-12 Thread Soliman, Yasmin
I'm using python 2.7, where exactly does the return statment with the (return (weight/(height*height))*703 calculation get posted in the function? def calc_BMI(weight,height): if bmi <=18.5: return 'underweight' elif bmi >= 18.5 and bmi <=24.9: return 'normal weight'

Re: [Tutor] BMI calc

2013-03-12 Thread Mark Lawrence
On 13/03/2013 02:08, Dave Angel wrote: On 03/12/2013 09:46 PM, Mark Lawrence wrote: On 13/03/2013 00:05, Soliman, Yasmin wrote: Hello all, I'm new to python and its been a stuggle so far. I'm attempting to create a BMI calculator in Wing 101 4.1. I keep getting syntax errors: def calc_BMI(wei

Re: [Tutor] BMI calc

2013-03-12 Thread Dave Angel
On 03/12/2013 09:46 PM, Mark Lawrence wrote: On 13/03/2013 00:05, Soliman, Yasmin wrote: Hello all, I'm new to python and its been a stuggle so far. I'm attempting to create a BMI calculator in Wing 101 4.1. I keep getting syntax errors: def calc_BMI(weight,height): return (weight/(height

Re: [Tutor] BMI calc

2013-03-12 Thread Mark Lawrence
On 13/03/2013 00:05, Soliman, Yasmin wrote: Hello all, I'm new to python and its been a stuggle so far. I'm attempting to create a BMI calculator in Wing 101 4.1. I keep getting syntax errors: def calc_BMI(weight,height): return (weight/(height*height))*703.0 if bmi <=18.5: print 'un

[Tutor] BMI calc

2013-03-12 Thread Soliman, Yasmin
Hello all, I'm new to python and its been a stuggle so far. I'm attempting to create a BMI calculator in Wing 101 4.1. I keep getting syntax errors: def calc_BMI(weight,height): return (weight/(height*height))*703.0 if bmi <=18.5: print 'underweight' elif bmi >= 18.5 and bmi <=24.9:

Re: [Tutor] Python version 2.7 or 3.0

2013-03-12 Thread Leam Hall
On 03/12/2013 11:47 AM, Alan Gauld wrote: On 12/03/13 14:20, Mike Nickey wrote: I'm seeing on StackOverflow that 2.7 is the standard for those that have libraries that haven't been ported to 3.1.2 yet. Does this mean that 2.7 is dead or dying? Is this just a well managed marketing campaign? L

Re: [Tutor] Python version 2.7 or 3.0

2013-03-12 Thread Steven D'Aprano
On 13/03/13 01:20, Mike Nickey wrote: Hey all, I'm used to python 2.7 but I'm seeing and hearing a lot about 3.0 and wanted to ask a few questions. I'm seeing on StackOverflow that 2.7 is the standard for those that have libraries that haven't been ported to 3.1.2 yet. Does this mean that 2.7 is

Re: [Tutor] implementing rot 13 problems

2013-03-12 Thread Danny Yoo
> Also note that I've deliberately left alone a bug in rot1(), to make > it easier to show a flaw in the original code that you'll want to fix. Doh. Never mind. _I'm_ the one who introduced that regression. :( Sorry! Here's a corrected definition for rot1(): # de

Re: [Tutor] implementing rot 13 problems

2013-03-12 Thread Danny Yoo
> ## > ## rot1: char -> char > ## Rotates a single character. > def rot1(char): > if char.isupper() or char.islower(): > test = 'M' if char.isupper() else 'm' > if char <= test: > return chr(ord(char) + 13) > else: > return chr(ord

Re: [Tutor] implementing rot 13 problems

2013-03-12 Thread Danny Yoo
On Tue, Mar 12, 2013 at 9:00 AM, RJ Ewing wrote: > Thank you all for the help. I really appreciated the suggestions. Some of > the things you pointed out, I originally used, but started changing thing > when it wasn't working. I got it to work, but if you could let me know if > there is anything I

Re: [Tutor] Need help with python keyboard press/navigation commands

2013-03-12 Thread ALAN GAULD
>> Finally, from a user experience point of view, it might be more logical to >> make the keys w,a,s,z North, West,East and South respectively  > >Most games use WASD, so user experience would be in favour of it >compared to WASZ. There are a couple of reasons for this:  > >You live and learn! :-)

Re: [Tutor] Need help with python keyboard press/navigation commands

2013-03-12 Thread Robert Sjoblom
> Finally, from a user experience point of view, it might be more logical to > make the keys w,a,s,z North, West,East and South respectively since its a > more logical correspondence to the compass points (assuming a standard > QWERTY keyboard layout). Most games use WASD, so user experience would

Re: [Tutor] implementing rot 13 problems

2013-03-12 Thread Peter Otten
RJ Ewing wrote: > Thank you all for the help. I really appreciated the suggestions. Some of > the things you pointed out, I originally used, but started changing thing > when it wasn't working. I got it to work, but if you could let me know if > there is anything I should do to make this code more

Re: [Tutor] implementing rot 13 problems

2013-03-12 Thread RJ Ewing
Thank you all for the help. I really appreciated the suggestions. Some of the things you pointed out, I originally used, but started changing thing when it wasn't working. I got it to work, but if you could let me know if there is anything I should do to make this code more pythonesque that would b

Re: [Tutor] Python version 2.7 or 3.0

2013-03-12 Thread Alan Gauld
On 12/03/13 14:20, Mike Nickey wrote: I'm seeing on StackOverflow that 2.7 is the standard for those that have libraries that haven't been ported to 3.1.2 yet. Does this mean that 2.7 is dead or dying? Is this just a well managed marketing campaign? Like any software the latest version will ev

Re: [Tutor] Matplotlib Slider Widget and changing colorbar threshold

2013-03-12 Thread Alan Gauld
On 12/03/13 14:10, Kevin Khan wrote: I am currently trying to work on a program that will allow the user to display their dataset in the form of a colormap and through the use of sliders, it will also allow the user to adjust the threshold of the colormap and thus update the colormap accordingly.

[Tutor] Python version 2.7 or 3.0

2013-03-12 Thread Mike Nickey
Hey all, I'm used to python 2.7 but I'm seeing and hearing a lot about 3.0 and wanted to ask a few questions. I'm seeing on StackOverflow that 2.7 is the standard for those that have libraries that haven't been ported to 3.1.2 yet. Does this mean that 2.7 is dead or dying? Is this just a well mana

[Tutor] Matplotlib Slider Widget and changing colorbar threshold

2013-03-12 Thread Kevin Khan
I am currently trying to work on a program that will allow the user to display their dataset in the form of a colormap and through the use of sliders, it will also allow the user to adjust the threshold of the colormap and thus update the colormap accordingly. The best to describe this would be th

Re: [Tutor] implementing rot 13 problems

2013-03-12 Thread Karim
What can be said after this detailed lesson...Bravo! On 12/03/2013 11:58, Steven D'Aprano wrote: On 12/03/13 16:57, RJ Ewing wrote: I am trying to implement rot 13 and am having troubles. My code is as follows: A few comments follow. def rot_text(self, s): ls = [i for i in s]

Re: [Tutor] implementing rot 13 problems

2013-03-12 Thread Steven D'Aprano
On 12/03/13 16:57, RJ Ewing wrote: I am trying to implement rot 13 and am having troubles. My code is as follows: A few comments follow. def rot_text(self, s): ls = [i for i in s] for i in ls: if i.isalpha(): if i.isupper(): if i <= 'M'

Re: [Tutor] implementing rot 13 problems

2013-03-12 Thread Alan Gauld
On 12/03/13 05:57, RJ Ewing wrote: I am trying to implement rot 13 and am having troubles. My code is as follows: There are better ways to do what you are doing but assuming this is a learning exercise rather than a serious project I'll make some comments: def rot_text(self, s): ls = [i

Re: [Tutor] Need help with python keyboard press/navigation commands

2013-03-12 Thread Alan Gauld
On 12/03/13 03:59, akuma ukpo wrote: I have tried def get_direction(self): """ whenever a key is pressed the character moves to the direction corresponding to the key """ 'North':w 'South': s 'East' : d 'West' : a What d