-1
I found this exercise in Code Wars where they expect to receive a single string, which will be a phone number, with the following format:
"(294) 926-8617"
But the best I can do is without the quotation marks:
(294) 926-8617
This is my code:
import random as rd
def create_phone_number(n):
b = ""
for number in range(len(n)):
a = rd.choice(n)
b += str(a)
if len(b) == 10:
print('(', end='')
print(''.join(map(str, b[:3])), end='')
print(')', end=' ')
print(''.join(map(str, b[3:6])), end='-')
print(''.join(map(str, b[6:])))
n = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
create_phone_number(n)