1
00:00:05,330 --> 00:00:06,450
Welcome back everyone.

2
00:00:06,620 --> 00:00:11,840
It's time to test your new skills with some function practice problems learning functions increases

3
00:00:11,840 --> 00:00:14,000
your price on skills exponentially.

4
00:00:14,000 --> 00:00:19,670
This also means that the difficulties or the problems you can solve also increases drastically.

5
00:00:19,670 --> 00:00:23,230
Let's get some practice of converting problem statements into Python code.

6
00:00:23,330 --> 00:00:26,180
We'll go through a series of function practice exercises.

7
00:00:26,180 --> 00:00:29,270
Then after this lecture we'll go through the solutions.

8
00:00:29,270 --> 00:00:31,320
Now there are two options for this material.

9
00:00:31,400 --> 00:00:36,140
One after viewing this lecture you can try out the exercises yourself and then go through the solutions

10
00:00:36,140 --> 00:00:37,380
lecture afterwards.

11
00:00:37,580 --> 00:00:41,950
Or if you're feeling a little bit uncomfortable the material still that's no problem.

12
00:00:41,960 --> 00:00:47,000
Just treat the solutions lecture as a code along lecture for a more guided practice approach again.

13
00:00:47,030 --> 00:00:51,110
If you're still feeling a little fuzzy all the concepts you can skip forward to the solutions lecture

14
00:00:51,320 --> 00:00:54,710
and treat it as a CO-2 long or we're going to break down each step for the function.

15
00:00:54,710 --> 00:01:00,260
Practice problems with that being said let's go ahead and jump over to the functions exercises so we

16
00:01:00,260 --> 00:01:02,210
can quickly go through them together.

17
00:01:02,210 --> 00:01:06,830
All right underneath your Paice on level 1 folder you should find a file called function dasht tasks

18
00:01:06,830 --> 00:01:11,010
start PI and basically it contains a list of comments and tasks.

19
00:01:11,060 --> 00:01:14,330
So your first one you need create a function that takes in two integers.

20
00:01:14,330 --> 00:01:18,210
Or you can have some skeleton code here for you and it returns a boolean true.

21
00:01:18,290 --> 00:01:25,470
If there is 10 and false if there is something other than 10 so let's check 10 then Task 2 is a very

22
00:01:25,470 --> 00:01:30,140
similar except you're going to check to see if these two numbers sum is 10.

23
00:01:30,330 --> 00:01:32,650
You return true if there is 10.

24
00:01:32,760 --> 00:01:35,470
Otherwise you are going to return the actual some value.

25
00:01:35,550 --> 00:01:38,160
So the first one should just be returning true or false.

26
00:01:38,160 --> 00:01:44,990
This other one is going to return either true or some other some value that is not 10 task 3.

27
00:01:45,040 --> 00:01:50,620
Create a function that takes in a string and returns back the first character of that string in uppercase.

28
00:01:50,660 --> 00:01:56,730
So you're going to need to use indexing as well as the thought upper method for this task for its creative

29
00:01:56,730 --> 00:02:01,320
function that takes in a string and returns the last two characters.

30
00:02:01,430 --> 00:02:05,980
If there are less than two characters return the string error and you can use this link.

31
00:02:05,980 --> 00:02:11,390
Right here there's a stack overfilling for help on how to actually grab the last characters of a string.

32
00:02:11,390 --> 00:02:15,500
Again you're going to create a function takes a string and return the last two characters.

33
00:02:15,500 --> 00:02:18,150
However your first can to check if there's less than two characters.

34
00:02:18,200 --> 00:02:24,620
If that's the case you return back error task find is given a list of integers.

35
00:02:24,730 --> 00:02:28,540
Return true if the sequence 1 2 3 is somewhere in the list.

36
00:02:28,540 --> 00:02:33,460
This one is probably the trickiest of all these tasks so you may want to try to break it down into smaller

37
00:02:33,460 --> 00:02:38,410
subproblems tasks 6 is given two strings.

38
00:02:38,410 --> 00:02:41,710
Create a function that returns the difference in length between the strings.

39
00:02:41,710 --> 00:02:44,700
So this difference in length should always be a positive number.

40
00:02:44,860 --> 00:02:45,670
So there's a hint.

41
00:02:45,670 --> 00:02:48,210
Maybe you want to search how to do an absolute value in Python.

42
00:02:48,370 --> 00:02:50,310
That's technically something we haven't covered yet.

43
00:02:50,440 --> 00:02:54,880
It's something however you should be able to easily google search or search on stack overflow for finding

44
00:02:54,880 --> 00:03:02,150
the absolute value I remember for finding the length of a string you can just use the LDN function task

45
00:03:02,150 --> 00:03:06,210
7 is given a list of integers if the length of the list is an even number.

46
00:03:06,260 --> 00:03:07,910
Return the sum of that list.

47
00:03:07,940 --> 00:03:11,310
It's the link for the list as odd return the max value in that list.

48
00:03:11,390 --> 00:03:16,070
So it's going to be either the sum or the max value depending on the actual length of the list.

49
00:03:16,070 --> 00:03:18,240
OK so you have 7 tasks there.

50
00:03:18,320 --> 00:03:22,430
I would say probably the toughest one is task number 5 but they tend to get harder as you go along.

51
00:03:22,430 --> 00:03:25,820
We tried to start off easy and then build the complexity as we go forward.

52
00:03:26,020 --> 00:03:30,140
If you have any questions feel free to post the Kewney forums that please make sure you watch the upcoming

53
00:03:30,140 --> 00:03:31,900
solution's lecture first.

54
00:03:31,990 --> 00:03:32,530
We'll see you there.
