00:00:00 – Hi friends and welcome to geeksforgeeks, in this tutorial, we will be learning more about
00:00:06 – python. We will learn about variables, expressions, conditions and function. So, let’s just
00:00:13 – move to the GeeksforGeeks IDE to run our scripts. Variables need not be declared first in python.
00:00:26 – They can be used directly. Variables in python are case sensitive as most of the other programming
00:00:34 – languages. Let’s look at an example, here we have 2
00:00:40 – variables “a” and “A”, “a” = 2 and “A” = 3. Let’s print both of them,
00:00:51 – so when we run the code, we get the output as 2 and 3 as expected.
00:00:59 – So, Variables need not be declared first in python. They can be used directly and they
00:01:05 – are case sensitive. Now, let’s talk about arithmetic expressions.
00:01:11 – We can perform the expressions directly, we need not do anything special for them. Suppose
00:01:21 – we first print (a + A), then we print (a*A), then we print (a/A). Now, let’s run this
00:01:34 – program. We can see that the output is as expected.
00:01:40 – Now, let’s talk about conditional statements, in python we can use if, else and else if
00:01:55 – which we call elif in python. Let’s look at an example now, suppose we
00:02:05 – need to check whether a variable is odd or even. If a % 2 = 0, we say “a is even”,
00:02:23 – elif a%2 is not equal to 0, we say “a is odd”. We could have used else, but for the
00:02:38 – sake of telling that else if is elif in python is used elif condition. We run this program
00:02:47 – and we get output as a is even. Now, let’s discuss how to declare a function
00:02:55 – in python. A function in python is declared by the keyword ‘def’ before the name of
00:03:03 – the function. The return type of the function need not be specified explicitly in python.
00:03:11 – The function can be invoked by writing the function name followed by the parameter list
00:03:18 – in the brackets. Let’s look at an example now. Suppose we
00:03:24 – need to define a function that checks whether a number is odd or even. So, we can do this
00:03:36 – by defining a function using the keyword def followed by the function name, followed by
00:03:45 – the name of variable in the code. I will copy the same code as i used in the previous example.
00:03:56 – To run this code, I need to write the name of function followed by the number I need
00:04:05 – to check. We get the answer as “a is even” In this tutorial we learnt about variables,
00:04:17 – expressions, conditions and functions and we saw examples on all of them. So, this brings
00:04:25 – us to the end of this tutorial. Thanks for watching, please leave us your likes and comments
00:04:31 – in the comments section.