Hi, This is my first post on the forum.
I'm currently learning the basics of Python from a 2014 copy of "Idiot's Guides: Beginning Programming". I'm using Python 3.5.3 on Mac OS.
The book is using examples from Python 3.3.
One of the first examples in the book is a simple question and response piece of code (below).
I then open it up in Terminal and this happens...
Just quick update. I was playing around with it and for some reason the code works when I type...
python ch3_1.py
What is your name? "Daniel"
Hello Daniel
Is that normal? I thought you didn't need to use quotation marks when responding only in the code?
I'm currently learning the basics of Python from a 2014 copy of "Idiot's Guides: Beginning Programming". I'm using Python 3.5.3 on Mac OS.
The book is using examples from Python 3.3.
One of the first examples in the book is a simple question and response piece of code (below).
input_var = input("What is your name? ") print("Hello " + input_var)I've saved that as a .py file and then gone to Terminal and changed the directory to the folder I have the file saved in.
I then open it up in Terminal and this happens...
python ch3_1.py What is your name? Daniel Traceback (most recent call last): File "ch3_1.py", line 1, in <module> input_var = input("What is your name? ") File "<string>", line 1, in <module> NameError: name 'Daniel' is not definedWhy is this happening? I thought it should look something like this...
Output:python ch3_1.py
What is your name? Daniel
Hello Daniel
Thanks in advance for any help or suggestions. Cheers, Dan :)Just quick update. I was playing around with it and for some reason the code works when I type...
python ch3_1.py
What is your name? "Daniel"
Hello Daniel
Is that normal? I thought you didn't need to use quotation marks when responding only in the code?