Jonathanliu92251.github.io

study memo


Project maintained by Jonathanliu92251 Hosted on GitHub Pages — Theme by mattgraham

Date: 2018-05-18

chapter 1. General

data + processing.

data: basic data type, + data structure: - sequences: “fix-length”? collections of objects accessed by numeric position string, tuple, list
- mappings: access by key objects - sets. simple collections of unique objects with no additonal kind of access - exceptions. simple data objects & events that control the execution of programs statements( try, except, finally, raise), - files.

General Notes:

Print

print([object, …], [sep=’ ’], [end=’n’], [file=sys.stdout])

print( "This is an error message", file=sys.stderr )
- PDF w/ ReportLab
- Error mesage / logs, w/ logging library
- Debugging messages, w/ logging library

Questions

1 基本数据类型 ?
2 数据结构 ?

chapter 2. Data Type

Numeric Types and Operators

Integer: 32 bit-long, ± 2 billion
Binary, Octal and Hexadecimal: 0bnnn, 0nnn 0x Long Integers nnnL int(), long() Floating-Point Numbers 64 bit-long, double-precision: 6.25E-2 Complex Numbers nnnJ: (2+3j)*(4+5j)

Numeric Conversion:

Built-in Math Functions:

chapter 6. ADVANCED EXPRESSIONS

modules:

Bit Manipulation Operators

Chapter 7. Variables

1. Naming:

2. How to debug in MicrosoftCode ?

chapter 8 Truth and Logic

8.1 Truth and Logic

8.2 Comparisons

- > < >= <= == !=

average = count != 0 and sum/count
if count ! =0 :
    average = count
else
    count = sum / count     Exact equality between floating-point numbers is a dangerous concept. abs(a-b)<0.0001

8.3 If - elif - else

if d1+d2 == 2 or d1+d2 == 12:
    print "field win" 
elif d1+d2==4 or d1+d2==9 or d1+d2==10 or d1+d2==11:
    print "field loses" 
else
    pass

average = sum/count if count != 0 else None

assert condition , expression

Chapter 9. Loop

for s in iterable :
    statements
    continue;
    break;

while expression:
    suite

Chapter 10. Functions

Chapter 12. SEQUENCES: STRINGS, TUPLES AND LISTS

Overview:

chapter 13. STRINGS

msg = "A very long" \
"message, which didn't fit on" \
"one line."

“日本” is made up of Unicode characters ‘U+65e5’ and ‘U+672c’. In Python, we write this string as ‘u’\u65e5\u672c’’.

r= "die 1 shows %i, and die 2 shows %i" % ( d1, d2 )

Chapter 14. TUPLES