## 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

## String Formatting in Python

In the previous article, we saw the use of escape sequences and raw strings now let us discuss Formatted Strings in Python, When we want to print formatted data, suppose combining multiple strings we can use the + operator. While something like this would work in practice, it would require a lot of plus operator … 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

## Global Variables in Python

In the previous article we looked at how we can return multiple variables in Python. Now let us discuss about Global Variables in Python, Global variables are the variables declared outside of functions and classes and that are accessible throughout the entire program. Here in this article we will mainly look at the use of … Read more