🗊Презентация GF_Python_Data_Structures

Категория: Образование
Нажмите для полного просмотра!
GF_Python_Data_Structures, слайд №1GF_Python_Data_Structures, слайд №2GF_Python_Data_Structures, слайд №3GF_Python_Data_Structures, слайд №4GF_Python_Data_Structures, слайд №5GF_Python_Data_Structures, слайд №6GF_Python_Data_Structures, слайд №7GF_Python_Data_Structures, слайд №8GF_Python_Data_Structures, слайд №9GF_Python_Data_Structures, слайд №10GF_Python_Data_Structures, слайд №11GF_Python_Data_Structures, слайд №12GF_Python_Data_Structures, слайд №13GF_Python_Data_Structures, слайд №14GF_Python_Data_Structures, слайд №15GF_Python_Data_Structures, слайд №16GF_Python_Data_Structures, слайд №17

Вы можете ознакомиться и скачать презентацию на тему GF_Python_Data_Structures. Доклад-сообщение содержит 17 слайдов. Презентации для любого класса можно скачать бесплатно. Если материал и наш сайт презентаций Mypresentation Вам понравились – поделитесь им с друзьями с помощью социальных кнопок и добавьте в закладки в своем браузере.

Слайды и текст этой презентации


Слайд 1





Python Data Structures
By Greg Felber
Описание слайда:
Python Data Structures By Greg Felber

Слайд 2





Lists
An ordered group of items
Does not need to be the same type
Could put numbers, strings or donkeys in the same list
List notation
A = [1,”This is a list”, c, Donkey(“kong”)]
Описание слайда:
Lists An ordered group of items Does not need to be the same type Could put numbers, strings or donkeys in the same list List notation A = [1,”This is a list”, c, Donkey(“kong”)]

Слайд 3





Methods of Lists
List.append(x) 
 adds an item to the end of the list
List.extend(L) 
Extend the list by appending all in the given list L
List.insert(I,x)
Inserts an item at index I
List.remove(x)
Removes the first item from the list whose value is x
Описание слайда:
Methods of Lists List.append(x) adds an item to the end of the list List.extend(L) Extend the list by appending all in the given list L List.insert(I,x) Inserts an item at index I List.remove(x) Removes the first item from the list whose value is x

Слайд 4





Examples of other methods
a = [66.25, 333, 333, 1, 1234.5] 	//Defines List
 print a.count(333), a.count(66.25), a.count('x') //calls method
2 1 0 	//output
a.index(333) 	
//Returns the first index where the given value appears 
1	 //ouput
a.reverse()				//Reverses order of list
 a				//Prints list a
 [333, 1234.5, 1, 333, -1, 66.25]	//Ouput
a.sort() 
a					//Prints list a
[-1, 1, 66.25, 333, 333, 1234.5]	//Output
Описание слайда:
Examples of other methods a = [66.25, 333, 333, 1, 1234.5] //Defines List print a.count(333), a.count(66.25), a.count('x') //calls method 2 1 0 //output a.index(333) //Returns the first index where the given value appears 1 //ouput a.reverse() //Reverses order of list a //Prints list a [333, 1234.5, 1, 333, -1, 66.25] //Ouput a.sort() a //Prints list a [-1, 1, 66.25, 333, 333, 1234.5] //Output

Слайд 5





Using Lists as Stacks
The last element added is the first element retrieved
To add an item to the stack,
 append() must be used
stack = [3, 4, 5]
stack.append(6)
Stack is now [3, 4, 5, 6]
To retrieve an item from the top of the stack, pop must be used
Stack.pop()
6 is output
Stack is now [3, 4, 5] again
Описание слайда:
Using Lists as Stacks The last element added is the first element retrieved To add an item to the stack, append() must be used stack = [3, 4, 5] stack.append(6) Stack is now [3, 4, 5, 6] To retrieve an item from the top of the stack, pop must be used Stack.pop() 6 is output Stack is now [3, 4, 5] again

Слайд 6





Using Lists as Queues
First element added is the first element retrieved
To do this collections.deque
 must be implemented
Описание слайда:
Using Lists as Queues First element added is the first element retrieved To do this collections.deque must be implemented

Слайд 7





List Programming Tools
Filter(function, sequence)
Returns a sequence consisting of the items from the sequence for which function(item) is true
Computes primes up to 25
Описание слайда:
List Programming Tools Filter(function, sequence) Returns a sequence consisting of the items from the sequence for which function(item) is true Computes primes up to 25

Слайд 8





Map Function
Map(function, sequence)
Calls function(item) for each of the sequence’s items
Computes the cube for the range of 1 to 11
Описание слайда:
Map Function Map(function, sequence) Calls function(item) for each of the sequence’s items Computes the cube for the range of 1 to 11

Слайд 9





Reduce Function
Reduce(function, sequence)
Returns a single value constructed by calling the binary function (function) 
Computes the sum of the numbers 1 to 10
Описание слайда:
Reduce Function Reduce(function, sequence) Returns a single value constructed by calling the binary function (function) Computes the sum of the numbers 1 to 10

Слайд 10





The del statement
A specific index or range can be deleted
Описание слайда:
The del statement A specific index or range can be deleted

Слайд 11





Tuples
Tuple
A number of values separated by commas
Immutable
Cannot assign values to individual items  of a tuple
However tuples can contain mutable objects such as lists
Single items must be defined using a comma
Singleton = ‘hello’,
Описание слайда:
Tuples Tuple A number of values separated by commas Immutable Cannot assign values to individual items of a tuple However tuples can contain mutable objects such as lists Single items must be defined using a comma Singleton = ‘hello’,

Слайд 12





Sets
An unordered collection with no duplicate elements
Basket = [‘apple’, ‘orange’, ‘apple’, ‘pear’]
Fruit = set(basket)
Fruit 
Set([‘orange’, ‘apple’, ‘pear’])
Описание слайда:
Sets An unordered collection with no duplicate elements Basket = [‘apple’, ‘orange’, ‘apple’, ‘pear’] Fruit = set(basket) Fruit Set([‘orange’, ‘apple’, ‘pear’])

Слайд 13





Dictionaries
Indexed by keys
This can be any immutable type (strings, numbers…)
Tuples can be used if they contain only immutable objects
Описание слайда:
Dictionaries Indexed by keys This can be any immutable type (strings, numbers…) Tuples can be used if they contain only immutable objects

Слайд 14





Looping Techniques
Iteritems():	
for retrieving key and values through a dictionary
Описание слайда:
Looping Techniques Iteritems(): for retrieving key and values through a dictionary

Слайд 15





Looping Techniques
Enumerate():
	for the position index and values in a sequence
Описание слайда:
Looping Techniques Enumerate(): for the position index and values in a sequence

Слайд 16






Zip():  
for looping over two or more sequences
Описание слайда:
Zip(): for looping over two or more sequences

Слайд 17





Comparisons
Operators “in” and “not in” can be used to see if an item exists in a sequence
Comparisons can be chained
a < b == c
This tests whether a is less than b and that b equals c
Описание слайда:
Comparisons Operators “in” and “not in” can be used to see if an item exists in a sequence Comparisons can be chained a < b == c This tests whether a is less than b and that b equals c



Похожие презентации
Mypresentation.ru
Загрузить презентацию