登録は簡単!. 無料です
または 登録 あなたのEメールアドレスで登録
data types により Mind Map: data types

1. number

1.1. types

1.1.1. int

1.1.1.1. store negative or positive number

1.1.2. float

1.1.2.1. store real number value

1.1.3. long

1.1.3.1. unlimited size

1.1.3.2. store integer value

1.1.4. complex

1.1.4.1. a+bi

1.2. useful build-in functions

1.2.1. min()

1.2.2. max()

1.2.3. round()

1.2.4. sqrt()

1.3. random number functions: import random

1.3.1. choice(seq)

1.3.2. randrange(start, stop, step)

1.3.3. shuffle(sq)

1.3.4. random.seed(10)

1.3.5. random.unifom(x1, x2)

2. String

3. python list

3.1. what?

3.1.1. collection of values

3.2. how to use

3.2.1. create

3.2.1.1. use list()

3.2.1.2. a = [1, 'a', (2, 'r')]

3.2.1.3. a = [[3, 4, 5], ['aa', 'bb'], [], 1, 2, 3]

3.2.2. access

3.2.3. slice

3.2.3.1. a[1:4] -> list of elements from 2 to 4

3.2.3.2. a[2: -1] -> list of elements from the last to 3th

3.2.4. delete

3.2.4.1. del list

3.2.4.2. del list[1][2]

3.2.5. edit

3.2.5.1. list1 = new_list

3.2.5.2. list[1] = value

3.3. list operations

3.3.1. multiplication

3.3.1.1. multiply 3 times: list*=3

3.3.2. iterator

3.3.2.1. for i in list:

3.3.2.2. for i, _ in enumerate(list):

3.4. build-in list function

3.4.1. len

3.4.2. max, min

3.4.3. sum

3.4.4. sorted(a)

3.4.5. list

3.4.6. any(list) return True if list has any True value else False

3.4.7. all(list) -> False if any False else True

3.5. built-in methods

3.5.1. list1.append(value) add value at the end of list

3.5.2. list1.insert(index, value)

3.5.3. list1.remove(index) <=> del list1[index]

3.5.4. list1.pop(index) remove and return value of element index-th

3.5.5. list1.clear() empty list

3.5.6. list1.index() return value at index

3.5.7. list.sort() sort list

3.5.8. list1.reverse() reverse list

3.6. when?

3.6.1. care about the order. List keeps order, dict does not

4. tuple

4.1. what?

4.1.1. a collection of value

4.1.2. immutable

4.1.3. permission of reading

4.2. how to use?

4.2.1. create

4.2.1.1. a= 1, 2, 'a'

4.2.1.2. a = (1, 2, 'a')

4.2.2. accessing

4.2.2.1. the same as list accessing

4.2.3. slice

4.2.3.1. the same as list slicing

4.2.4. delete

4.2.4.1. the same as list deleting

4.2.5. editing

4.2.5.1. can not edit

4.2.5.2. can edit value of mutable item. exp tuple1=(1, 2, 3, [2, 'a']) can resigned: tuple1[3][1] = 2 => tuple1 = (1, 2, 3, [2, 2])

4.3. build-in functions

4.3.1. almost same as list

4.4. build-in methods

4.4.1. t.count(value)

4.4.2. t.index(values) return the first position of value

4.5. when?

4.5.1. when we want to save data that we don't want it's changed or modified, exp credentials data of users

5. dictionary

5.1. what?

5.1.1. an unordered collection of values

5.1.2. hold key - value pairs

5.2. how to use?

5.2.1. create

5.2.1.1. dict1 = {'key1': value1, 'key2': value2}

5.2.1.2. empty dict={}

5.2.1.3. use dict()

5.2.1.4. use for loop: dict = {:x:x for x in range(8)}

5.2.1.5. new_dict = dict1.fromkeys( list of dict1_key, value) create new dict from existing one

5.2.2. access

5.2.2.1. by key: dict['key'] . if key does not exist, throw exceptions

5.2.2.2. dict1.get('key') return none if key does not exist

5.2.3. edit

5.2.3.1. by key

5.2.4. delete

5.2.4.1. del dict

5.2.4.2. delete dict['key']

5.3. build-in functions

5.3.1. len(dict)

5.3.2. any(dict): return True if dict has any True value of any key

5.3.3. all(dict) return True only when all keys have True value

5.3.4. sorted(dict)"

5.3.4.1. increasing

5.3.4.2. dont modify the original

5.4. build-in methods

5.4.1. dicts.key() return list of keys

5.4.2. dict2.items() return list of items

5.4.3. dict2.get('key1', value_if_key_is_not_found)

5.4.4. dict2.clear()

5.4.5. new_dict = dict2.copy() copy dict

5.4.6. pop

5.4.6.1. dict2.pop('key')': remove and return key-value pair

5.4.6.2. dict2.pop('key', value_if_key_not_exist) remove and return value with key, if key is not exist retiurn valua value_if_key_not_exist

5.4.7. dict2.popitem(): pop item by order

5.4.8. new_dict = dict1.fromkeys( list of dict1_key, value) create new dict from existing one

5.4.9. dict1 = dict2.update(dict1) : update dict1 by values of dict2 that it does not have

5.5. membership

5.5.1. 2 in dict1 : check key with value equals to 2 is in dict1

5.5.2. for key in dict:

5.6. when?

5.6.1. associate with key and value