Send Close Add comments: (status displays here)
Got it!  This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
Python: Literals


1. Python: Literals

2. Python: Literals


3. Literal
The English word "literal" comes from the Latin word for "letter".

4. Literal
A literal is an expressly written entity.

A literal value literally expresses a value.

The word "entity" is a nice way to say "thing" or "something".

5. Entity
The word entity means thing, as in an instance of something such as an object. A computer string is a sequence of entities.


A computer string is not part of a rope.

6. Strings
A string is a sequence of entities of the same type. When not specified, the word string usually means a text string or sequence of characters.

7. Delimit
The English word "delimit" means to mark the boundaries.

Double quote characters, ASCII #34, are used to delimit (the boundaries) of a string literal.

Single quote characters, ASCII #39, are used to delimit (the boundaries) of a character literal.

8. Strings and characters
A (character) string is made up of zero or more characters. An empty string has no characters. Note: Python has some other ways of delimiting strings (not covered here). So a string literal is zero or more characters delimited by the double quote character while a character literal is exactly one character delimited by the single quote character.

9. Floats and integers
An integer is a number without a fractional part.

A number, with an optional fractional part, represents an approximation to a mathematical real number.

Such numbers are called floating point approximations, or, for short, a float.

10. Literals
If a literal is to represent or be computed with an integer, write it as an integer literal.
40

If a literal is to represent or be computed with a float/double, write it as a float/double literal by including the decimal point.
40.0


11. End of page

12. Multiple choice questions for this page