On 17/08/16 23:15, Ken Mayer wrote: > I'm new to Python. I'm trying to do 3 things that are giving me invalid > syntax or other problems: > > 1) import numpy as np > > ImportError: No module named 'numpy'
Numpy is not part of standard Python. You need to install it seperately or, my preference, download a Python distribution such as Anaconda that comes with it pre-installed. > 2) pip install - U pip > > SyntaxError: invalid syntax' You are running pip from inside python, it is actually an external command that should be run from the OS command prompt (aka DOS or CMD prompt) > Also, is there any way I can copy entire code and paste it in the Python > 3.5 (32-bit) type DOS screen that I have? That's an interpreter intended for experimentation only. There are other more advanced Python interpreters that can accept large amounts of pasted code(*) but it is usually better to create a new file and save the code into the file then run the file as a script. [ (*)If you get Anaconda it comes with IPython which is an example of such an interpreter, it has a notepad concept where code can be pasted and executed. ] So for example if you created a file called myscript.py and pasted in the code: import sys name = input("Whats your name? ") for i in range(3): print("Hello ", name) sys.exit() You would run it using C:\WINDOWS> python path\to\myscript.py Or, if you use the standard Python IDE - IDLE - you can use the File->New menu to create a new python file then paste your code, save it and run it all using the menus. HTH -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor