Keyword Arguments in Python

In the previous article we looked at the usage of default arguments ..now we will look at what is the purpose behind the utilization of keyword arguments in Python. The arguments we have discussed so far, they were either default or positional arguments. Let us understand positional and keyword arguments with the help of an … Read more

Parameter Passing in Python

In the previous article, we have explored variable length arguments, now we will look at Parameter Passing in Python. When we pass a parameter to a function, how is it passed? Does it contain the same reference to a variable or a different variable, if we make any changes to this variable is it reflected … Read more

How Functions Work in Python

In the previous article, we discussed the applications/advantages of using Functions in Python, now we will examine how functions work in Python. Before we delve further let us look at an example program. What would the output of the above code look like? Analyzing How Functions Work in Python The program from earlier would result … Read more

Escape Sequences and Raw Strings in Python

In the previous article we saw some string programs to demonstrate common characteristics of Strings in Python, now let us examine the concept of escape sequences and raw strings in Python. Imagine the below statement as part of a program The program fails to execute simply because the apostrophe interferes with the program’s syntax where … Read more

Default Arguments in Python

In the previous article we saw the internal logic of Python functions and how they work. Now we will take a look at the Default Arguments in Python. Default arguments exist when the functions do not require values to be passed to them or the function accepts certain values even in the absence of user-given … Read more

Find First Digit of a Number Python program

In the previous article, we explored Global Variables in Python, now we will look at how we can obtain the first digit of any given number. We have also seen how we can obtain the last digit of a number in an older different article. For example, if the input values are: 7549: It should … Read more

Functions in Python

In the previous article, we saw how we could optimize code for two different problems. There is another way in which we can increase the effectiveness of code, that is true the use of in-built functions or user-defined rather than the use and repeat of long lines of code. So in this article, we will … Read more

Prime Factorization in Python

In the previous article we looked at how we can obtain the first digit of any given number, now we will look at how we can achieve prime factorization in Python. We are given a number n, we need to find prime factorization of this number. We need to consider all the divisors of the … Read more

Check if a List is sorted in Python

In the previous article, we saw how we can obtain a count of all the distinct elements of a list. Now we will look at how we can implement a program to Check if a List is sorted in Python. We need to check if the list is in non-decreasing order, as in every element … Read more

Returning multiple Variables in Python

In the previous article saw how parameters are passed and handled in Python, now we will look at how we can return multiple variables in Python. Here is an example program that returns two values: When we call the function we receive the two values from add_multiply, later the program prints out the value of … Read more