This Python program generates a random 10-digit phone number in the Vietnam format. The first three digits are predefined from a list of valid prefixes, while the remaining digits are randomly generated.
import random
def generate_phone_number():
prefixes = ['097', '098', '086', '032', '035', '037', '038', '039', '091', '094', '081', '085', '083', '070', '079', '077', '076', '090', '093', '089']
prefix = random.choice(prefixes)
suffix = ''.join(random.choices('0123456789', k=7))
return prefix + suffix
if __name__ == "__main__":
phone_number = generate_phone_number()
print(f"Generated phone number: {phone_number}")