import random


def generate_phone_num(length):
    """ Generate phone number."""
    string = ""
    while len(string) < length:
        string += '0123456789'[random.randint(0, 999999) % 10]
    return string