## 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. For example: While something like this would work in practice, it would require a lot of …

## Calculator program in Python

In the preceding article we have written a program to determine whether a given year is a leap year. Now we will look at a program to implement basic common calculator utility functions for user-given input numbers for whichever operation is selected. If we imagine a calculator and it’s working, we understand that there needs …

## Leap Year Program in Python

In the previous article we have seen the programs and logic relating to figuring out the largest of three numbers provided by user, in this article we will look at how to implement Leap Year logic in Python. Leap year is the year in which an additional day exists in February, and occurs about every …

## Largest of Three numbers program in Python

In the previous article we explored a problem involving a python game utilizing Even or Odd Logic, now we need to write a program to accept three numbers from the user and then automatically provide to us the largest of the three numbers. Suppose the user provides the program the numbers: a=10, b= 15, c=7 …

## Even-Odd problem in Python

Previously we have looked at the conditional statements in Python, In this article we will examine a problem related to even or odd concept. In this particular case of two examples imagine a game where you and your opponent are playing, and we are given a number of points. In the first example we have …

## if-else and elif statements in Python

In this article we will explore the If-else and elif statements in Python. These statements exist to execute code if certain conditional statements are satisfied. They can be very helpful for specific needs or tasks. For example while working on an online form, which requires the user to enter a username. The user has strongly …

## Find Last Digit in Python

In the previous article we have gone through the sum of n digits problem, we continue in this article with a look at another common problem which is finding out the last digit. Suppose a user enters the number 234, it would return 4. If a user entered 1000 it would return a zero. A …

## Bitwise Operators in Python

Sometimes we work with unusual digits or values which are involved in our program’s operations. One such case is when we work with Binary digits(bits) of integer values. Bitwise Operators in Python allow us to work or manipulate such data when required in our program. The Python language supports working with binary digits (bits) of …

## Days Before N Days in Python

In the previous article we explored the sum of Natural Numbers in Python. Suppose we are given some days, each number means a successive different day for example: Sunday represents 0, 1 represents Monday, 2 represents Tuesday, 3 represents Wednesday, 4 represents Thursday, 5 represents Friday, 6 represents Saturday. The program calculates the number of …

## Sum of Natural Numbers in Python

In the previous article we have explored Geometric Progression in Python. Now we will start looking at various common programs to further our understanding of Python such as Sum of Natural Numbers, Finding Last Digits or Days Before N number of Days. In this article we will explore the concept of Sum of Natural Numbers …