Hi! We are going to be doing the third basic syntax video today So some other functions that can be helpful like I mentioned before are the range function. The range function can cause some misconception because when I do range(0,10) it’s going to go 0 through 9. That can often be confusing but basically just always remember that the range function, the ending argument is always one more than it will display. So if you do range(13,19), it will start with 13 but it will end one less than the ending attribute. so just remember that your range function attribute will have to be one higher than the range you would like to return. So the “all” function is a function to check if all the elements of an object that are capable of returning its members one at a time are true. So in this example, I am testing to see if all numbers in this range are greater than 5. So here’s an example of this syntax: you type “all” all(x>5 for x in range(0,10). So in this range, basically what Python is going to do, is run through each number and say “is it true?”. And if all of them are true then it will report back true. But if every single number that Python goes through, and say even one is false, it will report back false because the “all” function is all or nothing. Obviously its going to come back with false because there’s 5 numbers in this range that are not greater than 5. So you can also do it as a list by doing all([x>5 for x in range(0.10]) So this does the same thing but puts this as a list. So this list, Python is going to go through each number in the list and determine if it is true or false, and again it is going to be false. You can also do another function called the “any” function which is just like the all function is just like the all function, but instead of all or nothing it checks to see if any of the values are true and so we’re looking to see if any of the values match our argument as opposed to all the values like in the all function. Here’s an example: “any” any(x>5 for x in range(0,10)). This comes back true because of course some of the numbers in this range are going to be greater than 5. And again just like with the “all” function you can make into a list or a tuple just by adding the brackets or adding the parenthesis. So let’s do some more print statements; just getting a little more advanced here. So we’re gong to assign a=3, that’s a variable assignment b=5. Now we’re going to want to do print “a” plus “b”. And it gives you 8 of course; it’s gonna print the output of the two arguments. You can use a comma to combine two statements. So, for example print “a” plus “b”. So this is a string, it’s gonna say a+b is not a variable and then comma “a” plus “b” which is adding the variables together. So we’ve designated this as a string and this is going to print the variables. So it says a+b=8 which is the string right here and then the integer which is what is assigned to the variables. You can also use a plus sign to combine two statements so the same example except using a plus sign to combine two statements would be print a plus b equals + str(a+b) and that will give you the same thing but you used a plus sign and the string argument to convert this into a string. The sorted function is a function that a function that orders a list of numbers. So say you want to find the ascending order of a list of numbers that you have assigned to “c”. C equals [8,3,-7,0,2,-4,1] sorted(c) “enter”. And this is the list sorted in ascending order, so starting with the lowest number which was -7 and ending with the highest number which was 8. this was really helpful and can also be done using strings. you can do sorted( using strings. You can do sorted(c, reverse=True). Now this sorts it in reverse order, and remember to put the capital T in True because that’s because this is what the built in function is in Python. Ok so we’re gonna reassign our variable since we cleared our console. “c=” reassigning our list: c=8,3,-7,0,2,-4,1. Close the list. Now c.sort close parenthesis, enter. Now if you do print(c), you can see the list has changed and now the list goes from -7 to 8. You can also do it backwards by doing c.sort reverse equals true. Capital T True. Print(c). And again C has changed going in descending order. That’s all for this video; that’s all for basic syntax Next, we’re going to introduce the open function and talk a little about importing data and writing files to text. So that’s all for now, thank you!