Posts

Python - Variables

Image
  Variables in Python Now that you have Python installed and know how to start the Python shell, you’re ready to do something with it. We’ll begin with some simple calculations and then move on to variables. Variables are a way of storing things in a computer program, and they can help you write useful programs. Calculating With Python Normally, when asked to find the product of two numbers like 8 × 3.57, you would use a calculator or a pencil and paper. Well, how about using the Python shell to perform your calculation? Let’s try it. Start the Python shell by double-clicking the IDLE icon on your desktop or, if you’re using Ubuntu, by clicking the IDLE icon in the Applications menu. At the prompt, enter this equation: >>> 8 * 3.57  Notice that when entering a multiplication calculation in Python, you use the asterisk symbol (*) instead of a multiplication sign (×). How about if we try an equation that’s a bit more useful?  Suppose you are digging in your backyard and uncover

Python - A Slithering Language

Image
 A computer program is a set of instructions that causes a computer to perform some kind of action. It isn’t the physical parts of a computer—like the wires, microchips, cards, hard drive, and such—but the hidden stuff running on that hardware. A computer program, which I’ll usually refer to as just a program, is the set of commands that tell that dumb hardware what to do. Software is a collection of computer programs. Without computer programs, almost every device you use daily would either stop working or be much less useful than it is now. Computer programs, in one form or another, control not only your personal computer but also video game systems, cell phones, and the GPS units in cars. Software also controls less obvious items like LCD TVs and their remote controllers, as well as some of the newest radios, DVD players, ovens, and some fridges. Even car engines, traffic lights, street lamps, train signals, electronic billboards, and elevators are controlled by programs. Program