Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-16 Thread Kent Johnson
On Sat, Aug 16, 2008 at 1:22 AM, Joseph Bae [EMAIL PROTECTED] wrote: convertTo == C and convertToCelsius(temp) or convertToFahrenheit(temp) This idiom has a pitfall. Consider A and B or C If B can evaluate to a false value, such as None or 0, the expression will not do what you

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-16 Thread Lie Ryan
On Sat, 2008-08-16 at 07:40 +0200, [EMAIL PROTECTED] wrote: Message: 1 Date: Fri, 15 Aug 2008 22:22:00 -0700 From: Joseph Bae [EMAIL PROTECTED] Subject: Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined To: Alan Gauld [EMAIL PROTECTED] Cc: tutor@python.org

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-16 Thread Matti/Tritlo
I too am a Beginner at python, and i have been playing around with it for about a week. While playing around, i decided to make a calculator program (A Very simple one) to calculate area and also to convert farenheit to celcius and vice versa. So, here is the code: def options(): print

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-16 Thread Kent Johnson
On Sat, Aug 16, 2008 at 12:07 PM, Matti/Tritlo [EMAIL PROTECTED] wrote: Some quick notes: print options() No need for the 'print' here, options() already prints. The extra print will print the return value of options(), which is None. def triangle_area(width, height): return width *

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-16 Thread Lie Ryan
On Sat, 2008-08-16 at 16:07 +, Matti/Tritlo wrote: I too am a Beginner at python, and i have been playing around with it for about a week. While playing around, i decided to make a calculator program (A Very simple one) to calculate area and also to convert farenheit to celcius and vice

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-16 Thread Kent Johnson
On 8/16/08, Lie Ryan [EMAIL PROTECTED] wrote: never use input(), use raw_input() instead. input() parses the string it receives first, and may (read: WILL in the hands of certain persons) allow user to input certain strings that get parsed into dangerous codes. Use int(raw_input()) instead to

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-15 Thread Joseph Bae
Thanks for the help! I have managed to get a good temperature converter program working! I am working on beefing it up a bit with some exception handling and an and-or trick. The error handling works okay but I am having problems using and-or. Here's my updated code: def main(): true = 1

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-15 Thread Joseph Bae
Sorry! I copied the sample output from my command prompt incorrectly. Correct sample output: Enter A Number : 50 Convert to (F)ahrenheit or (C)elsius? C 50 Fahrenheit = 32 Celsius *50 *(not 32) Celsius = 147 Fahrenheit Joe On Fri, Aug 15, 2008 at 10:22 PM, Joseph Bae [EMAIL PROTECTED] wrote:

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-15 Thread Steve Willoughby
Joseph Bae wrote: Thanks for the help! I have managed to get a good temperature converter program working! I am working on beefing it up a bit with some exception handling and an and-or trick. The error handling works okay but I am having problems using and-or. Here's my updated code: def

[Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-14 Thread Joseph Bae
Hi all, I'm new to Python (and programming in general) and need some help! Here is my code so far for a temperature conversion program (converts between Fahrenheit and Celsius): temp = input(Enter A Number : ) convertTo = raw_input(Convert To (F)ahrenheit or (C)elsius? : ) if convertTo == F:

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-14 Thread Josh Rosen
In Python, def is an executable statement. Your function is not defined until the def statement is run by Python. If you move your function definitions earlier in the code so that your functions are defined before they're used, this code will run properly. Josh R. On Aug 14, 2008, at

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-14 Thread Emad Nawfal (عماد نوفل)
On Thu, Aug 14, 2008 at 7:08 PM, Joseph Bae [EMAIL PROTECTED] wrote: Hi all, I'm new to Python (and programming in general) and need some help! Here is my code so far for a temperature conversion program (converts between Fahrenheit and Celsius): temp = input(Enter A Number : )

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-14 Thread Tuxicomane
Joseph Bae [EMAIL PROTECTED] writes: Hi all, Hi ! (and sorry for my approximative English ... ;-) I'm new to Python (and programming in general) and need some help! Here is my code so far for a temperature conversion program (converts between Fahrenheit and Celsius): temp = input(Enter A

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-14 Thread Alan Gauld
Joseph Bae [EMAIL PROTECTED] wrote temp = input(Enter A Number : ) convertTo = raw_input(Convert To (F)ahrenheit or (C)elsius? : ) if convertTo == F: convertedTemp = convertToFahrenheit(temp) print %d Celsius = %d Fahrenheit % (temp, convertedTemp) else: convertedTemp =