Write a function that takes an area code, a three digit number,and produces a seven digit phone number
import random
def area_code(r):
print "Your new phone number is (%s)" % r,
i = 1
while i <= 7:
#It assigned a random number from 0 to 9 to the variable n.
n = random.randint(0, 9)
print n,
i += 1
What is display after the code is run is the following:
What 3 digits area code do you want in your number?: 240
Your new phone number is 240 1 6 3 2 1 9 1
But is there a way that I can code this better or another way? Like having the the number come out like this: (240) 163-2191