python

python

Python program to print the multiplication table of a specific number

Python program to print the multiplication table of a number in two different ways. We will learn how to use a for loop and how to use a while loop to print the multiplication table.

Read
python

3 ways in Python to calculate GCD or HCF of two numbers

Python program to calculate GCD or HCF of two user input numbers. Learn how to do it by using a for loop, by reverse looping and by Euclid's division algorithm.

Read
python

Python program to check if a number is a Niven or Harshad number

Python program to check if a number is a Niven or Harshad number or not. The program will take one number as input from the user and print if it is a Niven or Harshad number.

Read
python

Python example to print the function name as string with __name__ and __qualname__

Python program to get the function name as a string. We will learn how to use the __name__ and __qualname__ attributes to get the name of a function in this post with example.

Read
python

3 different Python programs to get a string after a substring

Python program to get a string after a specific substring. We will learn three different ways to get the string after a given substring of a string in Python.

Read
python

Python assert statement explanation with examples

Python assert statement explanation with examples. This post will explain to you what is assert statement and how it works in Python with examples.

Read
python

3 different Python programs to remove the first character of string

Python program to remove the first character of a string in 3 different ways. We will learn how to do it by using string slicing, split and with the replace method in Python.

Read
python

Python program to check if a number is a perfect number or not

Python program to check if a number is a perfect number or not with user input number. It will also find all perfect numbers in a given range.

Read
python

Python program to check for Moran numbers

Python program to check if a number is moran number or not. This post will also show you how to find all Moran numbers in a range with user input values.

Read
python

Difference between random.sample() vs random.choice() in Python

This post will explain the differences between random.sample() and random.choice() in Python. Both of these functions are defined in the random module and they are used to get a list or a single random element from a list.

Read