A natural number is a whole number used for counting: 0, 1, 2, 3, and so on. It excludes negative and fractional values. Some conventions reserve “natural number” for positive values and call the version including 0 “whole numbers,” so check which convention is being used. section 2.9
Natural numbers appear whenever data records counts, such as concert attendance, children in a family, or customer complaints. They can also serve as identifiers or encode categories—for example, 0 for CAT, 1 for DOG, and 2 for BIRD—but those codes do not make the categories numerical quantities. section 2.8 section 2.9
Listing natural numbers in Python
naturals = [i for i in range(0, 15)] print(naturals) This produces the whole numbers from 0 through 14. Python’s decimal notation uses the digits 0 through 9 and combines them by place value to represent larger numbers. section 2.9
A recorded value can look like a natural number without representing a discrete quantity. Baristas may report coffee measurements as whole grams because kitchen scales and working habits limit precision, while the ideal amount could theoretically lie between grams. Treating every whole-number measurement as a count can therefore misclassify the variable. section 4.3
naturals = [i for i in range(0,15)] #1 print(naturals) #2
Run the short Python listing to see a sequence of natural numbers generated with range(). section 2.9
