Beginning with Python, II

Turns out I was correct in my previous post on starting python – Macs come with Python 2 installed, but Windows does not.

But for the life of me, since installing Python 2 on my laptop, I could not get it to run in PowerShell (and here I’ll add that my understanding of command line is as basic as it can be, mainly culled from Zed A. Shaw’s command line crash course).

In case of not having a clear understanding of what happened, but just trusting what I was told to do, I entered

[Environment]::SetEnvironmentVariable(“Path”, “$env:Path;C:/Python27”, “User”)

into PowerShell. This, as far as I understand, configures the path correctly after installing Python. Don’t ask me to explain that, since the previous sentence is literally the full extent of what I understand of what the above did.

And so, using the one command I know in Python, I used Notepad ++  to write the following, uh, program (I titled it history1.py – it made sense at the time.) In my previous post I used the IDE PyCharm instead of Notepad ++. I’m using the latter in this post as I wanted to make sure I could run Python in Powershell, which is Microsoft’s command line interface.

Python Exercise 1

And then, in PowerShell, with an easy python history1.py, success was had (large arrows added for convenience)

Python Exercise 2

Things happened that I wanted to happen! Today Woodsworth, tomorrow significant contributions to the field!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s