How to generate a random phone number using Python? Last Updated : 27 Mar, 2021 Comments Improve Suggest changes Like Article Like Report In this article, we will learn how to generate a random phone number using Python. In general, Indian phone numbers are of 10 digits and start with 9, 8, 7, or 6. Approach: We will use the random library to generate random numbers.The number should contain 10 digits.The first digit should start with 9 or 8 or 7 or 6, we will use randint() method.The remaining 9 digits will also be generated using the randint() method. Examples: The generated random phone numbers would looklike: 9980231467 8726189362 Implementation: Python3 # import module import random as r ph_no = [] # the first number should be in the range of 6 to 9 ph_no.append(r.randint(6, 9)) # the for loop is used to append the other 9 numbers. # the other 9 numbers can be in the range of 0 to 9. for i in range(1, 10): ph_no.append(r.randint(0, 9)) # printing the number for i in ph_no: print(i, end="") Output: 8349603502 Comment More infoAdvertise with us Next Article How to generate a random phone number using Python? P pulamolusaimohan Follow Improve Article Tags : Misc Python Python-random Practice Tags : Miscpython Similar Reads Get Phone Number Information using Python In this article, you will learn how you can get the information about phone number like the country name to which the phone number belongs to, or the network service provider name of that phone number just by writing a simple Python program. Python provides a module name phonenumbers for this task. 2 min read How to generate a random number between 0 and 1 in Python ? The use of randomness is an important part of the configuration and evaluation of modern algorithms. Here, we will see the various approaches for generating random numbers between 0 ans 1. Method 1: Here, we will use uniform() method which returns the random number between the two specified numbers 1 min read Create a Random Password Generator using Python In this article, we will see how to create a random password generator using Python. Passwords are a means by which a user proves that they are authorized to use a device. It is important that passwords must be long and complex. It should contain at least more than ten characters with a combination 5 min read How to Generate a Random Password Using Ruby? Generating a random password is a fundamental task in cybersecurity and application development. Creating a secure random password is very easy with the Ruby library. This article will show how to generate a random password in Ruby in Python. Generate a Random Password Using RubyBelow are the code e 2 min read How to generate a unique username using Python A username is a unique name that is mainly used on websites and apps. A username is used to identify a person. For example, if your name is Akshay and you want to create your account on any social media app, here we need a username such that another person can find us. It is not possible to search b 4 min read Like