“Número de telefone aleatório do Python” Respostas de código

Número de telefone aleatório do Python

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:]
MitchAloha

criar número de telefone aleatório 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="")
Ceefar

Respostas semelhantes a “Número de telefone aleatório do Python”

Perguntas semelhantes a “Número de telefone aleatório do Python”

Mais respostas relacionadas para “Número de telefone aleatório do Python” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código