% Copyright 2002 Reto Stamm. % Permission is granted to copy, distribute and/or modify this document % under the terms of the GNU Free Documentation License, Version 1.1 % or any later version published by the Free Software Foundation; % with no Invariant Sections, with the Front-Cover Texts being % at least the original author and title. % A copy of the license is included in the section entitled ``GNU % Free Documentation License''. \chapter{Programming} \section{Tell the computer what to do} When you are programming, all you do is to tell the computer what to do. Example: Dear Computer, please Write ``Hello'' on the screen. Then, write all the numbers from 0 to 10, each on their own line. The Computer is really lazy, but also always does what you tell it to do. If you don't tell it to do something, it won't do it. If you are not really precise in telling it what to do, it will do something different from what you are expecting. When you tell people to do something, you expect them to think. Like this: \begin{itemize} \item Close the Door! (Of course Only if it's open.) \item Wash the dishes! (The dirty ones of course, not the clean ones.) \item Vacuum! (The carpet, not the ceiling!) \end{itemize} If you don't tell the computer exactly what needs to be done, it will get confused, do the wrong thing, do nothing at all, or complain. \section{Computer Languages} Computer Languages are the only thing the Computer understands. They are made so that the computer can not ``find excuses'' to do something else from what you are telling it to do. They are Simple. In a computer language\\ every Idea\\ or command\\ is on its own line. Kind of like a shopping list. That makes it easier for you to understand. The computer does not really care. There are many computer languages. They are all a bit different from each other, but not too much. \section{Python} Python is a computer language. print ``hello''; will write hello to the screen. x = read; will read what you type in. What will this do? print ``What's your name''; x = read; print ``Hello '', x;