1 00:00:00,060 --> 00:00:04,180 We will see the different building functions with Japan. 2 00:00:04,180 --> 00:00:15,210 It's the first function is all and this function returns true if all of the elements of the tuple are 3 00:00:15,210 --> 00:00:19,230 true or if the tuple is empty. 4 00:00:19,290 --> 00:00:25,740 Now let us pass the tuple to do to this function. 5 00:00:25,920 --> 00:00:35,310 Since all of the elements in Japan are true this function returns true. 6 00:00:35,330 --> 00:00:43,950 Now we will define and not that tuple which contains the following element 0 or 1 2 3. 7 00:00:44,040 --> 00:00:47,570 So the tuple Contains these elements. 8 00:00:47,580 --> 00:00:59,730 If you can recall from our discussion on boolean data type the value 0 is considered false whereas 1 9 00:01:00,240 --> 00:01:02,080 is considered true. 10 00:01:02,130 --> 00:01:13,530 So if we pass this tuple to the function all it has returned funds because zero is considered false. 11 00:01:13,530 --> 00:01:16,530 This function has returned false. 12 00:01:16,530 --> 00:01:27,680 Similarly let's define another tuple which is empty and if we now pass this jeopardy to the function 13 00:01:27,810 --> 00:01:39,940 ie it is going to return true because this function returns true even if the tuple is empty. 14 00:01:39,940 --> 00:01:46,090 Next is the any function and it returns true if any of the element is true. 15 00:01:46,960 --> 00:01:51,110 If the tuple is empty it returns false. 16 00:01:51,160 --> 00:02:04,750 So if we pass the tuple to 6 to the function in need it's going to return false because this tuple is 17 00:02:04,900 --> 00:02:05,630 empty. 18 00:02:05,630 --> 00:02:17,740 Next if we pass the tuple to 5 which contains one of the elements which is false and the other elements 19 00:02:17,890 --> 00:02:29,280 are true in that case it should return true because because this function returns true even if one of 20 00:02:29,280 --> 00:02:31,260 the elements is true. 21 00:02:31,470 --> 00:02:39,740 Next is the length function which it adorned the length of the tuple or the number of items in the tuple 22 00:02:40,800 --> 00:02:45,840 Max returns the largest item in the tuple. 23 00:02:45,870 --> 00:02:53,120 So let us now pass the tuple to 5 to the function Max. 24 00:02:53,190 --> 00:03:03,590 So it is going to return 3 because 3 is the largest number in this tuple coming to the next function 25 00:03:03,680 --> 00:03:08,660 men it is going to return the least number in the tuple. 26 00:03:08,660 --> 00:03:17,980 So this is going to return 0 from the stupid next is the sum function and it is going to return the 27 00:03:17,980 --> 00:03:28,320 sum of all the elements in a tuple so if we pass this triple chip five to the function sum it's going 28 00:03:28,320 --> 00:03:35,940 to calculate the sum of the elements in this tuple 0 1 2 and 3. 29 00:03:35,940 --> 00:03:46,530 Next is the function tuple and this constructor the tuple constructor can be used to create a tuple 30 00:03:46,890 --> 00:03:55,340 it can be used to convert an item a goal like a list string set or a dictionary to Japan. 31 00:03:55,350 --> 00:04:02,400 So here I have defined a string containing this text. 32 00:04:02,670 --> 00:04:07,320 And then I have defined a list containing these elements. 33 00:04:07,530 --> 00:04:17,970 Now using the built in function tuple also known as the tuple constructor I can convert an eye trouble 34 00:04:18,420 --> 00:04:19,880 into a tuple. 35 00:04:20,040 --> 00:04:29,850 So let us pass this string SDR one to the to the built in function tuple auditable constructor. 36 00:04:29,850 --> 00:04:43,240 So as you can see the string SDR 1 has been converted into a tuple each substring in the string is converted 37 00:04:43,330 --> 00:04:49,590 into an element in the tuple enclosed in parentheses. 38 00:04:49,600 --> 00:05:02,210 Now let us pass a list which is another item a bill to the built in function tuple so this list has 39 00:05:02,210 --> 00:05:06,070 been converted to a tuple here. 40 00:05:06,260 --> 00:05:16,490 As you can see if you want to check the type of the tuple your ID we can pass this as an argument to 41 00:05:16,490 --> 00:05:18,060 the function type. 42 00:05:18,560 --> 00:05:22,680 And as you can see the data type is Japan. 43 00:05:22,730 --> 00:05:23,960 Next is. 44 00:05:23,980 --> 00:05:34,250 We are going to discuss about the methods that can be used on Python tuples the index method it returns 45 00:05:34,280 --> 00:05:38,630 the index of the first appearance of an item manageable. 46 00:05:38,660 --> 00:05:48,110 So I'm going to call the index method on the tuple to 5 and I want to know the index of the element 47 00:05:48,140 --> 00:06:00,400 to in this tuple so the element 2 has an index 2 as you can see next as the count method and it returns 48 00:06:00,440 --> 00:06:10,630 the number of times an item appears in our tuple so calling the method count on the tuple took five. 49 00:06:11,290 --> 00:06:23,350 I'm going to pass the element 1 and it has appeared once in this tuple and say for example I want to 50 00:06:23,350 --> 00:06:28,030 pass another element which is not present. 51 00:06:28,020 --> 00:06:37,530 Indeed Japan in that case it returns zero because the element 6 does not exist in the Japan. 52 00:06:37,860 --> 00:06:45,030 And this brings us to the end of the topic on functions and method entrepreneurs.