Logo         Community
The Company
Your Account
Contact Us
Python 101 (part 2): If Wishes Were Pythons
Build conditional expressions, slice and dice strings, and accept user input from the command line.

| Tax Evasion |

The first - and simplest - object type you're likely to encounter is the number. I've already shown you a few examples of how Python treats numbers last time - but here's a quick refresher anyway:

Python 1.5.2 (#1, Aug 25 2000, 09:33:37)  [GCC 2.96 20000731 (experimental)] on
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> print 24+1
>>> print 12*10
>>> print 65/5
>>> print 15-9

There are four basic number types available in Python:

Integers: These are plain-vanilla numbers like 23, 5748, -947 and 3; they are also the most commonly-used type.

Floats: These are typically decimal numbers, although Python also allows you to use the scientific notation to represent them - for example, 3.67, 98.573 or 5.347e-17.

Long integers: These are integer values which are too large to be handled by the regular Integer type - for example, 45734893498L or 53267282982L. Note the uppercase "L" appended to the end of a long integer, which makes this type easier to identify.

Complex numbers: You may remember these from algebra class (I don't, but that's probably because I slept my way through college) - 2.5+0.3j, 4.1-03.j and so on. These numbers can be broken up into "real" and "imaginary" parts...the "imaginary" part is what you bank, while the "real" part is what the government takes away in taxes.

How to do Everything with PHP & MySQL
How to do Everything with PHP & MySQL, the best-selling book by Melonfire, explains how to take full advantage of PHP's built-in support for MySQL and link the results of database queries to Web pages. You'll get full details on PHP programming and MySQL database development, and then you'll learn to use these two cutting-edge technologies together. Easy-to-follow sample applications include a PHP online shopping cart, a MySQL order tracking system, and a PHP/MySQL news publishing system.

Read more, or grab your copy now!

previous page more like this  print this article  next page
In trog...
Logging With PHP
Building A Quick-And-Dirty PHP/MySQL Publishing System
Output Buffering With PHP
Date/Time Processing With PHP
Creating Web Calendars With The PEAR Calendar Class
In the hitg report...
Crime Scenes
Animal Attraction
Lord Of The Strings
In boombox...
Patience - George Michael
Think Tank - Blur
My Private Nation - Train
In colophon...
Hostage - Robert Crais
The Dead Heart - Douglas Kennedy
Right As Rain - George Pelecanos
In cut!...
American Chai
The Core
Find out how you can use this article on your own Web site!

Copyright © 1998-2018 Melonfire. All rights reserved
Terms and Conditions | Feedback