Anyway, it seemed only natural to take up programming again, as I thoroughly enjoyed it the first time around. Maybe this time, it'll stick.
Apropos of nothing, here's this magnificent white lion to look at!
This class started with the ceremonial loading of Notepad++ and trying to configure it, working off of old screen shots and playing "Guess the menu item" via the instructions given me. Once that was done, I downloaded and installed Python v. 2.7.8 and then, in my typical fashion, proceeded to try and run a simple program. -_- This was akin to trying to communicate with a cow via using an IBM Selectric. Nothing happened. I typically skip all the verbiage in programming books and run right to the appendices. In this case, I overlooked a crucial step, when using the "Start" > "Command" in Windows. I SHOULD have been looking for the Command.exe that comes as a standard part of all Windows versions, yet I was going directly to the Python.exe file and it was unable to find the simple program we had been given to try out our brand-new installs of Python.
Once that was sorted out, I typed within the Python command line, at the chevrons >>>:
x = 1
x = x + 1
print x
This gave me 2, which let me know that I had installed Python correctly, or that it was running correctly, or that the sun hadn't exploded and the earth was melting. Whatever I did, it worked and happiness reigned.
The professor teaching this course is a huge proponent of open-source coding and sharing of information. We are allowed and encouraged to use the text that is provided with the course. The link can be found here: PYTHON FOR EVERYONE and I encourage those of you who are interested and still reading this to get the documentation and follow along at home.
I've zipped through the first chapter, and am on to the second. I'm rather behind at this point, due to playing in the symphony and my initial fumbling around on my desktop, which is the norm for me. I'll get caught up and finish the course. Never having dealt with Python before, I'm seeing a lot of weird syntax and whatnot, but Dr. Chuck assures us all that it isn't going to make much sense in the beginning. It does to me, in a Boolean sort of way, but I understand computers and how they work and think; I'll worry about the details as we go along.
He's a terrible programmer, but wondrous to look at!
So, here are the answers and results that I came up with for Chapter 1, and I'll update as we go. I'm also doing #ROW80, although the poor people there probably think I've died, or have given up on me. #NaNoWriMo is next month and I am writing a sequel to "Music of the Spheres", or more Undead Alien Underground Railroad happenings are to come. On to Beethoven's Fifth Symphony and Rossini's "Thieving Magpie" overture. Peace out.
PYTHON FOR EVERYONE
Chapter 1 Exercises
1.1. What is the function of secondary memory in a computer. The function of the secondary memory in a computer is to (C) store
information for the long term -- even beyond a power cycle.
1.2. What is a program? A program is a set or series of instructions directing
the computer to execute a series of actions at your behest.
1.3. What is the difference between a compiler and an interpreter? A compiler
is used to translate an entire program into machine language. An interpreter is
used to execute a program in a high-level language by translating it one line
at a time.
1.4. Which of the following contains "machine code"? a) The Python
interpreter. The Python source file is the file written by the programmer.
1.5. What is wrong with the following code:
>>> primt 'Hello world!'
File "<stdin>", line 1
primt 'Hello world!'
ˆ
SyntaxError: invalid syntax
>>>
The instruction 'print' is spelled 'primt' yielding a syntax error
1.6. Where in the computer is a variable such
as "X" stored after the following Python line finishes? Depends; if
written in an editor, "X" is contained in the file, which is stored
in the main memory. If that file is saved to secondary memory, it is there as well.
If it is just part of a small program that was typed into the interface, it is
lost on re-boot.
1.7. What will the following program print
out:
x = 43
x = x +
1
print x
44
1.8. Explain each
of the following using an example of a human capability: (1) Central Processing
Unit or CPU. The brain. (2) Main Memory. Again, the brain. The hard drive of
the computer. (3) Secondary Memory. A notebook, a grocery list. Anything
outside the body used to store ancillary information. In terms of the computer,
a portable disk drive or a thumb drive, cloud drive. (4) Input Device. Eyes,
ears, mouth. Keyboard, mouse, touchscreen (interface) (5) Output device. Mouth,
hands (for writing, signing). Printer, speakers, screen. (I add computer
correlations, because I have Asperger, and I don’t allow for wiggle room – deal
with it.)
1.9. How do you
fix a “Syntax Error”? Correct the speeling. :D
No comments:
Post a Comment