Что такое findslide.org?

FindSlide.org - это сайт презентаций, докладов, шаблонов в формате PowerPoint.


Для правообладателей

Обратная связь

Email: Нажмите что бы посмотреть 

Яндекс.Метрика

Презентация на тему Recursion. Tuples, lists, dictionaries

StructureKey points of the Meeting III: English meetingQuick recap of Meeting IIRecursionTuplesListsDictionariesMeeting V = Midterm!Meeting III 10 WordsOffice Hours II – this time collective strugglePreparation for Midterm!
15.06.2017Meeting III: Recursion + tuples, lists, dictionaries© Andrey Tymofeiuk(some rights reserved) StructureKey points of the Meeting III: English meetingQuick recap of Meeting Recap of Meeting I & Meeting IIFunctionsFunctions: DefinitionsMethodsBisection searchVariablesTypes of variablesFor Breakthrough example RecursionRecursion is a way of programming or coding a problem, in Recursion: finding factorialdef recursive_factorial(n):	if n == 1:		return 1	else:		return n*recursive_factorial(n-1)def iterative_factorial(n):	result = RecursionA recursive function has to terminate to be used in a Tuples, lists, dictionaries/dicts Tuple: ()ninjaTurtlesTuple = (‘Michelangelo’, ‘Leonardo’, ‘Donatello’, ‘Rafael’)Empty tuple: ()Important property: It List: []ninjaTurtlesList = [‘Michelangelo’, ‘Leonardo’, ‘Donatello’, ‘Rafael’]Empty list: []OrderedCan index: ninjaTurtlesList[1] Useful remarks Dictionary: {}ninjaTurtlesDict = [‘Michelangelo’ : ‘Leader’, ‘Leonardo’ : ‘Sniper’, ‘Donatello’ : HILARIOUS!!! In January it was: …and in 1 week it became! :-D Quickly check:In: ‘Givi’ in Meeting III: 10 wordsKey points of the second meetingQuotes - лапкиCurly Homework till Meeting IV (09/02/17)Homework for the following weekPSet2 for “less Midterm: 29.06.2017Key points:You can use laptopYou can google. But everything can Office Hours IIAmerica House, Saturday, 17/06/2017, 10:00 – 14:00…but w/o me ☺ Thank you!
Слайды презентации

Слайд 2 Structure
Key points of the Meeting III: English

StructureKey points of the Meeting III: English meetingQuick recap of

meeting
Quick recap of Meeting II
Recursion
Tuples
Lists
Dictionaries
Meeting V = Midterm!
Meeting III

10 Words
Office Hours II – this time collective struggle
Preparation for Midterm!



Слайд 3 Recap of Meeting I & Meeting II
Functions
Functions:

Recap of Meeting I & Meeting IIFunctionsFunctions: DefinitionsMethodsBisection searchVariablesTypes of

Definitions
Methods
Bisection search
Variables
Types of variables
For loops
While loops
Conditional statements
Declarative and Imperative

knowledge!

Слайд 4 Breakthrough example

Breakthrough example

Слайд 5 Recursion
Recursion is a way of programming or

RecursionRecursion is a way of programming or coding a problem,

coding a problem, in which a function calls itself

one or more times in its body.

Слайд 6 Recursion: finding factorial
def recursive_factorial(n):
if n == 1:
return

Recursion: finding factorialdef recursive_factorial(n):	if n == 1:		return 1	else:		return n*recursive_factorial(n-1)def iterative_factorial(n):	result

1
else:
return n*recursive_factorial(n-1)
def iterative_factorial(n):
result = 1
for i in range (2,

n+1):
result *= i
return result

Iteration

Recursion

vs


Слайд 7 Recursion
A recursive function has to terminate to

RecursionA recursive function has to terminate to be used in

be used in a program. A recursive function terminates,

if with every recursive call the solution of the problem is downsized and moves towards a base case. A base case is a case, where the problem can be solved without further recursion. A recursion can lead to an infinite loop, if the base case is not met in the calls. 

Слайд 8 Tuples, lists, dictionaries/dicts

Tuples, lists, dictionaries/dicts

Слайд 9 Tuple: ()
ninjaTurtlesTuple = (‘Michelangelo’, ‘Leonardo’, ‘Donatello’, ‘Rafael’)

Empty

Tuple: ()ninjaTurtlesTuple = (‘Michelangelo’, ‘Leonardo’, ‘Donatello’, ‘Rafael’)Empty tuple: ()Important property:

tuple: ()

Important property: It is ordered

Can index: ninjaTurtlesTuple [1]

= ‘Leonardo’

Immutable (we can’t add ‘Splinter’ and we can’t change ‘Rafael’ to ‘Shrek’)

Mix of element types, it could be:

ninjaTurtlesTuple = (‘Michelangelo’, ‘Leonardo’, ‘Donatello’, ‘Rafael’, 3, 4.5)

Funky stuff: ninjaTurtlesTuple[1:2] = (‘Leonardo’, )








Слайд 10 List: []
ninjaTurtlesList = [‘Michelangelo’, ‘Leonardo’, ‘Donatello’, ‘Rafael’]

Empty

List: []ninjaTurtlesList = [‘Michelangelo’, ‘Leonardo’, ‘Donatello’, ‘Rafael’]Empty list: []OrderedCan index:

list: []

Ordered

Can index: ninjaTurtlesList[1] = ‘Leonardo’

Mutable! We CAN add

‘Splinter’! We CAN change elements!

Mix of element types, it could be:

ninjaTurtlesList = [‘Michelangelo’, ‘Leonardo’, ‘Donatello’, ‘Rafael’, 3, 2.66]

No funky stuff: ninjaTurtlesList[1:2] = [‘Leonardo’]








Слайд 11 Useful remarks

Useful remarks

Слайд 12 Dictionary: {}
ninjaTurtlesDict = [‘Michelangelo’ : ‘Leader’, ‘Leonardo’

Dictionary: {}ninjaTurtlesDict = [‘Michelangelo’ : ‘Leader’, ‘Leonardo’ : ‘Sniper’, ‘Donatello’

: ‘Sniper’, ‘Donatello’ : ‘Explosives’, ‘Rafael’ : ‘Medic’]

Empty dictionary:

{}

There is a key

‘Michelangelo’ – key0, ‘leader’ – val0

Mutable! We CAN add ‘Splinter’ : ‘Chief’!

ninjaTurtlesDict[‘Splinter’] = ‘Chief’

Quickly check:
In: ‘Givi’ in uselessSeparatistsDict (!!!!!!!!!!!!!HILARIOUS, 26.01.2017!!!!!!!!!!!)
Out: False








Слайд 13 HILARIOUS!!! In January it was:

HILARIOUS!!! In January it was:

Слайд 14 …and in 1 week it became! :-D

…and in 1 week it became! :-D Quickly check:In: ‘Givi’


Quickly check:
In: ‘Givi’ in uselessSeparatistsDict

(!!!!!!!!!!!!!HILARIOUS, 26.01.2017!!!!!!!!!!!)
Out: False

Слайд 15 Meeting III: 10 words
Key points of the

Meeting III: 10 wordsKey points of the second meetingQuotes -

second meeting
Quotes - лапки
Curly braces – фігурні скобки
Square brackets

– квадратні скобки
Alias – «псевдонім» (дзеркало)
Tuple – кортеж
To append - приєднати
To extend – продовжити
To split – розділити, розколювати
Pointer – вказівник
Tutor - репетитор










Слайд 16 Homework till Meeting IV (09/02/17)
Homework for the

Homework till Meeting IV (09/02/17)Homework for the following weekPSet2 for

following week
PSet2 for “less comfortable” + listen Lecture 5

& Lecture 6

Pset3 for “more comfortable”

Create GitHub account for “more comfortable”

START YOUR PREPARATION FOR MIDTERM!!! ☺











Слайд 17 Midterm: 29.06.2017
Key points:
You can use laptop



You can

Midterm: 29.06.2017Key points:You can use laptopYou can google. But everything

google. But everything can be solved just by your

memory.




Don’t be afraid – minor mistakes will not count










Слайд 18 Office Hours II
America House, Saturday, 17/06/2017, 10:00 –

Office Hours IIAmerica House, Saturday, 17/06/2017, 10:00 – 14:00…but w/o me

14:00…but w/o me ☺






Ukraine, Mykoly Pymonenka St, 6,

Київ


Don’t forget Passport/Driving License!

Andrey: 050 44 33 585









  • Имя файла: recursion-tuples-lists-dictionaries.pptx
  • Количество просмотров: 124
  • Количество скачиваний: 0