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

Factorial Program in Python

In the previous article we have seen the logic and code for obtaining the count of the digits in a number, in this article we will see how we can obtain the Factorial of any user-entered number in Python. Before we discuss the Factorial Program in Python, let us revise the concept of Factorial. The … Read more

Program to return Smaller list Elements in Python

In the previous article we discussed handling of slicing on tuples, strings and lists in python. Now let us explore how we can handle a problem related to list concept. We need to write a function that takes a list as input, also takes a value for ‘x’ as input. The function should return all … Read more

Program to separate Even and Odd List Elements

In the previous article we explored how we could write a function to return the smaller elements from a list. Now we will apply similar logic to write a function to separate even and odd list elements. We are given a list, we need to write a function that takes the list as argument and … Read more

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 … Read more

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 … Read more

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 … Read more