Can someone please explain what is wrong with the function. I am reading an old version of Python Programming by John Zelle
def main(): x = input("Enter a number between 0 and 1: ")
New to python. Please help
|
Can someone please explain what is wrong with the function. I am reading an old version of Python Programming by John Zelle
def main(): x = input("Enter a number between 0 and 1: ")
Apr-23-2019, 02:34 AM
The problem is that you define the function without calling it. Add
main() after to call / invoke the function.By the way, there's probably not much reason to use an old book. I'd recommend Think CS as a great tutorial, but if it doesn't suit your taste then I recommend our tutorials section. The only thing I recommend you avoid is "Learn Python the Hard Way." I like the title in theory but the author, to put it as nicely as possible, is known to put his foot in his mouth and it can be extremely confusing / misleading for new programmers. |
|