New to python, baffled by program output

From: Lazareth S. Link (Lazareth_at_gmail.com)
Date: 09/30/04


Date: 30 Sep 2004 12:15:24 -0700

Hiya to whoever might stumble across this.

I've recently taken up learning how to script/program in python.
I've made my first program, a simple fahrenheit-celsius converter,
both ways.
For some reason I fail to comprehend, the program writes a line of
"None" when rerun in a while loop.
Here is the code:

---START---
def choice_c():
        print
        celsius = input("Input celsius: ")
        print "Fahrenheit: ",cel_fah(celsius)
        print

def choice_f():
        print
        fahrenheit = input("Input fahrenheit: ")
        print "Celsius: ",fah_cel(fahrenheit)
        print

def cel_fah(placeholder):
        return 9.0/5.0*placeholder+32

def fah_cel(placeholder):
        return (placeholder-32.0)*5.0/9.0

def options():
        print "press 'c' to convert celsius to fahrenheit."
        print "press 'f' to convert fahrenheit to celsius."
        print "press 'q' to exit program."

choice = "n"
options()
while choice != "q":
        choice = raw_input("Choice: ")
        if choice == "c":
                choice_c()
        elif choice == "f":
                choice_f()
        print options()
---END---

Any of you know why it prints that line? Is is just my comp?
If any applies, how to get around it?
Would greatly appreciate the help.



Relevant Pages

  • Re: Assigning to dynamic class attributes
    ... > looking for guidance in my first program. ... > really just need to replicate code for each data field? ... I don't completely understand how symbols work or why they are ... > def from_s ...
    (comp.lang.ruby)
  • Tkinter, image not appearing in function but without function
    ... why is the first program not working? ... from Tkinter import * ... master = Tk ... def key: ...
    (comp.lang.python)
  • text adventure question
    ... I am working on a text adventure game for python to get back into ... def character_sheet: ... global reputation ... print "Please choose another command. ...
    (comp.lang.python)
  • Re: noob question: "TypeError" wrong number of args
    ... or it's newer syntactic-sugar-version would become somewhat more ... Python source code and outputs the same source code with only one change: ... insert the string 'self" as the first parameter of every "def ... Python code, which is unavoidable for such a syntactic change. ...
    (comp.lang.python)
  • Re: Python 3K or Python 2.9?
    ... function/method argument that might as well be hidden in the compiler ... You could add some syntax to Python such that '.x' was equivalent to ... def factory: ... C.method = foo ...
    (comp.lang.python)