Python glossary
Line 9: | Line 9: | ||
The '''int''' function can take a floating point number or a string, and turn it into an int | The '''int''' function can take a floating point number or a string, and turn it into an int | ||
− | '''len''' is a built-in Python function that returns the number of characters in a '''string''' | + | '''len''' is a built-in Python function that returns the number of characters in a '''string'''. |
− | '''type''' is a function that returns the type of the parameter | + | |
+ | '''type''' is a function that returns the type of the parameter, either str, int or float. | ||
A statement is an instruction that the Python interpreter can execute. | A statement is an instruction that the Python interpreter can execute. |
Revision as of 13:10, 1 May 2013
Back to Python
A value is one of the fundamental things — like a word or a number — that a program manipulates
objects are classified into different classes, or data types: 4 is an integer, and "Hello, World!" is a string
The type converter float can turn an integer, a float, or a syntactically legal string into a float.
The int function can take a floating point number or a string, and turn it into an int
len is a built-in Python function that returns the number of characters in a string.
type is a function that returns the type of the parameter, either str, int or float.
A statement is an instruction that the Python interpreter can execute. We have only seen the assignment statement so far. Some other kinds of statements that we’ll see shortly are while statements, for statements, if statements, and import statements. (There are other kinds too!)
An expression is a combination of values, variables, operators, and calls to functions. Expressions need to be evaluated. If you ask Python to print an expression, the interpreter evaluates the expression and displays the result.
Back to Python