In this post, We will see how to write a python program for finding prime numbers from the list of numbers in different ways. Click on this link : Prime Number Example: Input: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] Output: Prime Number : -> 2, 3, 5, 7, Input: [15, […]
Author: Ankit Rai
Python | Simple Notepd Gui Application using tkinter
In this post, we will see how to make a notepad Gui application using tkinter module of Python. Basic idea : when you open an already existing file then you have to show all the contents of the file to the text editor..ie. you have to take all contents of the file and insert them […]
Python – Program for checking whether a number is Prime or not?
In this post, We will be going to see different ways to write a code in Python for checking whether a number is Prime or not, provided number > 1. Prime Number is a natural number which is greater than 1 and that has no positive divisors other than 1 and number itself. Examples : […]
Python – Program for checking a number is Armstrong or not?
In this post, We will be going to see different ways to write a code in Python for checking a number is Armstrong or not? Armstrong number is a number in which the sum of each digit raised to the power of a number of digits present in a given number is equal to the […]
Python – Program for counting number of letters in a word
In this post, We will be going to see different ways to write a code in Python for counting number of letters in a word Example: Input: Word = “BioChemiThon” Output: B -> 1 i -> 2 o -> 2 C -> 1 h -> 2 e -> 1 m -> 1 T -> 1 […]
Python – Program for Factorial of a Number
In this post, We will be going to see different ways to write a code in Python for the factorial of a number. Formula for finding factorial of a Number N : N * (N – 1) * (N – 2) * (N – 3) * ……* 2 * 1. Note: N must be a […]
Python – Program for Maximum of two numbers
In this article, We will see different ways to write a Python code to find the maximum of two numbers. Examples: Input: number1 = 10, number2 = 5 Output: 10 Input: number1 = 25, number2 = 50 Output: 50 Now, let’s see the different ways to code this program: Code 1: By using Comparison Operator. […]
Python | Program that matches a word containing ‘a’ in the given string by using regular expression
Given a statement(string), the task is to check if that string contains any word which contains ‘a’ in it then print that word otherwise print no any word containing ‘a’ in the inputted string. Examples: Input: Graphic Era Deemed to be University Output: Graphic Era Input: Geeks for Geeks Output: no any word containing ‘a’ […]
Python – Program to accept only binary string
In this problem a string is given, our task is to check the string is a binary string or not i.e. in the form of 1’s or 0’s or both 1’s and 0’s. Examples: Input : ‘01010101010’ Output : Accepted Input : ‘geeks101’ Output: Not Accepted Approach 1: We firstly create a set of the […]
Python | program to check each string in the list of strings whether it is palindrome or not and showing that result in the list of tuple forms.
A string is said to be palindrome if the reverse of the string is the same as the string. For example, “naman” is a palindrome, but “ankit” is not a palindrome. Iterative Method: Run a loop from start to half of the length of the string. Check the first character to the last character of […]