Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python random phone number

import random

def phn():
    n = '0000000000'
    while '9' in n[3:6] or n[3:6]=='000' or n[6]==n[7]==n[8]==n[9]:
        n = str(random.randint(10**9, 10**10-1))
    return n[:3] + '-' + n[3:6] + '-' + n[6:]
Comment

generate random number python

import random

random.randint(lower, upper)
Comment

create random phone number python

# 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="")
Comment

generate random number python

import random
lower_limit = 0 # Can be anything
upper_limit = 100 # Again, can be anything
# Print it out
print(f"Here is a random number: {random.randint(lower_limit, upper_limit)}
Comment

PREVIOUS NEXT
Code Example
Python :: loginrequiredmixin django 
Python :: pack tkinter 
Python :: list pop python 
Python :: python trim 
Python :: python sort algorithm 
Python :: Python Tkinter Frame Widget 
Python :: iterate over a set python 
Python :: stack error: command failed: import sys; print "%s.%s.%s" % sys.version_info[:3]; 
Python :: keras normalize 
Python :: os.startfile() python 
Python :: piecewise linear regression python 
Python :: open and write in a file in python 
Python :: python log file 
Python :: a sigmoid function 
Python :: how to find a prime number 
Python :: python list of dictionaries to list 
Python :: how to create barcode in python 
Python :: size of set python 
Python :: word2vec python 
Python :: Check and Install appropriate ChromeDriver Version for Selenium Using Python 
Python :: intersection python dict 
Python :: find index of sublist in list python 
Python :: how to stop thread python 
Python :: find array length in python 
Python :: can serializer returns an object in django 
Python :: channel hide command in discord.py 
Python :: python convert b string to dict 
Python :: **kwargs in python 
Python :: python how to drop columns from dataframe 
Python :: change markersize in legend matplotlib 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =