Friday, May 10, 2013

Python Notes

Strings can be enclosed in either single or double quotes:

type("17")
<type 'str'>

Assignment operator:

17 = n

Printing:

print message
>>What's up, Doc?
print n
>>17
print pi
>>3.14159

Types:

type(message)
<type 'str'>

** is exponentiation

def NAME(LIST OF PARAMETERS):
STATEMENTS

a print statement with no arguments prints a new line

or type: new_line()
or type: three_lines() if you want 3 lines instead of 1

True and False, not true and false

3 logical operators: and, or, and not

int() and float()

No comments:

Post a Comment