Re: [Tutor] Polymorphic function in Python 2 & 3?

2013-09-07 Thread Steven D'Aprano
On Sat, Sep 07, 2013 at 12:45:02PM -0700, Albert-Jan Roskam wrote: > Hi, > > I have a class and I want it's initializer to be able to take both > byte strings (python 3: byte objects) and unicode strings (python 3: > strings). [...] I need bytes because I am > working with binary data. Conside

Re: [Tutor] cs student needs help import math

2013-09-07 Thread Don Jennings
On Sep 7, 2013, at 6:02 PM, Byron Ruffin wrote: > > >>> math.ceil(math.pi) > 4 > ... but I get the error when using ceil... > > pepsticks = ceil(peplength / StickLength) > Traceback (most recent call last): > File "", line 1, in > pepsticks = ceil(peplength / StickLength) > NameError

Re: [Tutor] cs student needs help import math

2013-09-07 Thread Chris Down
On 2013-09-07 17:02, Byron Ruffin wrote: > I am writing a simple program based off an ipo chart that I did correctly. > I need to use ceil but I keep getting an error saying ceil is not defined. > I did import math, I think. I am using 3.2.3 and I imported this way... > > >>> import math > >>> mat

Re: [Tutor] cs student needs help import math

2013-09-07 Thread Amit Saha
On Sun, Sep 8, 2013 at 8:02 AM, Byron Ruffin wrote: > I am writing a simple program based off an ipo chart that I did correctly. > I need to use ceil but I keep getting an error saying ceil is not defined. > I did import math, I think. I am using 3.2.3 and I imported this way... > import mat

[Tutor] cs student needs help import math

2013-09-07 Thread Byron Ruffin
I am writing a simple program based off an ipo chart that I did correctly. I need to use ceil but I keep getting an error saying ceil is not defined. I did import math, I think. I am using 3.2.3 and I imported this way... >>> import math >>> math.pi 3.141592653589793 >>> math.ceil(math.pi) 4 >>>

Re: [Tutor] Polymorphic function in Python 2 & 3?

2013-09-07 Thread Dave Angel
On 7/9/2013 15:45, Albert-Jan Roskam wrote: > Hi, > > I have a class and I want it's initializer to be able to take both byte > strings (python 3: byte objects) and unicode strings (python 3: strings). So > it's foward compatible Python 2 code (or backward compatible Python 3 code, > if you lik

[Tutor] Polymorphic function in Python 2 & 3?

2013-09-07 Thread Albert-Jan Roskam
Hi, I have a class and I want it's initializer to be able to take both byte strings (python 3: byte objects) and unicode strings (python 3: strings). So it's foward compatible Python 2 code (or backward compatible Python 3 code, if you like). If needed, the arguments of __init__ are converted i

Re: [Tutor] Is Python a scripting language

2013-09-07 Thread Alan Gauld
On 07/09/13 09:13, Alan Gauld wrote: of the term Python is more than a scripting language it is a purpose programming language ... Oops, that should be *general purpose* -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ _

Re: [Tutor] why do i keep getting syntax errors in python when this runs

2013-09-07 Thread Luke Pettit
def main (): Celsius = float (input ("What is the Celsius temperature? ")) Fahrenheit = 9.0 / 5.0 * Celsius + 32 print("The temperature is ", Fahrenheit, " degrees Fahrenheit.") main() You need to check your capitalisation on all the basic things for a start # def main() Def? # then you call it w

Re: [Tutor] Is Python a scripting language

2013-09-07 Thread Alan Gauld
On 07/09/13 08:18, #PATHANGI JANARDHANAN JATINSHRAVAN# wrote: I just wanted to know what exactly are scripting language used for Your best bet is to read what wikipedia has to say on the subject. The whole question of "scripting languages" has become clouded in recent times and the definit

[Tutor] Is Python a scripting language

2013-09-07 Thread #PATHANGI JANARDHANAN JATINSHRAVAN#
Hi all, I just wanted to know what exactly are scripting language used for and if python is one such language. Can it be used in place of say, PHP? I'm asking because I have a project in my 1st sem to design a website using PHP and since I already know a good deal of python and nothing of PHP,

Re: [Tutor] why do i keep getting syntax errors in python when this runs

2013-09-07 Thread James Griffin
!-- On Fri 6.Sep'13 at 5:27:23 BST, mike johnson (pretor...@hotmail.com), wrote: > can you please help me figure out why this isnt working thanks > # convert.py > # this program is used to convert Celsius temps to Fahrenheit > # By: James Michael Johnson > > Def main (): > Celsius = float (inp