10 Digit Mobile Number Validation in Python29 Aug 2024 | 7 min read Introduction:In this article, we are discussing how to check 10 digit mobile number validation in Python. Here we are only checking the validation of 10 digit mobile number. The mobile number is 7894561230. There are some criteria for validating mobile number, which is -
When the 0 digits add at the front of any mobile number, then this is 12 digit mobile number, and it is also validating number. Algorithm 1 of checking validation of mobile number:Here we share the algorithm for checking the validation of mobile numbers. We have done it using Python programming language. In Python, there is various kind of modules. 're' module is one of them. This module is used for matching the pattern. The steps for checking the validation of the mobile number are given below -
Program code for checking the validation of a mobile number using the above algorithm:Some examples of checking the validation of a mobile number are given below - Example 1: Here we give an example of checking the validation of a mobile number in Python. We import re module for this program. The code is given below - Output: Now we compile the above code in Python, and after successful compilation, we run it. Then the output is given below - Enter a Mobile number :7894561230 This is a valid mobile number Example 2: Here we give another example of checking the validation of a mobile number in Python. We import re module for this program. The code is given below - Output: Now we compile the above code in Python, and after successful compilation, we run it. Then the output is given below - This is an invalid mobile number Example 3: Here we give another example of checking the validation of a mobile number in Python. We import re module for this program. The code is given below - Output: Now we compile the above code in Python, and after successful compilation, we run it. Then the output is given below - Enter the phone number: 2894561230 This is an invalid mobile number Example 4: Here we give another example of checking the validation of a mobile number in Python using the '[6-9][0-9]{9}' pattern. We import re module for this program. The code is given below - Output: Now we compile the above code in Python, and after successful compilation, we run it. Then the output is given below - Enter a Mobile number :2894561230 This is not a valid mobile number Algorithm 2 of checking validation of mobile number:Here we share another algorithm for checking the validation of mobile numbers. We have done it using Python programming language. In Python, there is various kind of modules. 're' module is one of them. This module is used for matching the pattern. The steps for checking the validation of the mobile number are given below -
Now we give an example using the above algorithm to check list of numbers is valid or not. Example: Here we give an example of checking the validation of a mobile number in Python using the above algorithm. We import re module for this program and create a function. The code is given below - Output: Now we compile the above code in Python, and after successful compilation, we run it. Then the output is given below - 7894561230 is a valid mobile number 28945612301 is not a valid mobile number 0894561230 is a valid mobile number 9894561230 is a valid mobile number 78945h1230 is not a valid mobile number 78@4561230 is not a valid mobile number Algorithm 3 of checking validation of mobile number using numpy:Here we share another algorithm for checking the validation of mobile numbers using numpy. The steps for checking the validation of the mobile number are given below -
Example: Here we give an example of checking the validation of a mobile number in numpy using the above algorithm. The code is given below - Output: Now we compile the above code in Python, and after successful compilation, we run it. Then the output is given below - 2894561230 It is not a valid mobile number Conclusion:In this article, we are discussing how to check 10 digit mobile number validation in Python. Here we have three different approaches to checking whether the number is validated. But the condition of the validated mobile number is always the same: the number must be started between 6 to 9, any number, and the rest digits of the validated mobile number must be started between 0 to 9, any number. And also, there must not be any special character and alphabet. |
This tutorial will teach us how to compress the given image using the Python script. Image compression is a process of reducing an image's size without degrading the image quality. There are many tools available on the internet where we need to upload and compress the...
10 min read
? One-Way ANOVA in Python One-way ANOVA (also known as "analysis of variance") is a test that can be used to determine any significant statistical differences between the results of a variety of groups. Hypothesis: One-way ANOVA is based on the below alternative and null hypotheses. The H0 (null hypothesis)...
2 min read
In this tutorial, we will learn how to send or push notifications; implement the functionality of push notifications and why we use the user notification. Push notifications are a beneficial method of communication with the user. These are used to send or notify the user of a...
6 min read
In the following tutorial, we will understand how to build a Snake Game using the PyGame library in the Python programming language. But before we get started, let us briefly understand what Snake Game is. A Brief Overview of the Snake Game Snake is a video game invented in...
18 min read
An Introduction to Seaborn Pairplot In this tutorial, we will understand Seaborn Pairplot with the help of the pairplot() function in the Python programming language. This function can considerably help analyze the exploratory data for machine learning projects. We will also discover the syntax of the...
5 min read
In pandas, a type of list called a series can incorporate number, string, twofold, and different sorts of information. Conversely, Pandas Series returns an item as a list, where n is the length of the series information and the record goes from 0 to n....
6 min read
__ init __ in Python If you have been using object-oriented programming, you may have run into the word "init" quite often. __init__ is a Python method. It is analogous to the constructors in languages like Java and C++. Knowing classes and objects in Python will make...
4 min read
Introduction: The Twitter API (Application Programming Interface) is a collection of tools that enables programmatic interaction between developers' applications and the Twitter platform. By using the Twitter API, developers can access and retrieve data, post new tweets, retrieve user information, and more. This makes it possible to build applications...
4 min read
Dictionary is one of the most used data types in Python. It is an unordered collection of key: value pairs. Every value has a corresponding key that identifies it. A dictionary is a mutable collection, meaning we can modify the values. One factor that makes a...
4 min read
In this tutorial, we will learn about the Lee Algorithm, which is used to solve maze routing problems. We will implement this algorithm using the Python programming language. Maze routing problems are one of the most interesting and asked programming problems. Lee algorithm is one of...
7 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India