[Python] How to generate phone numbers?

Discussão em 'Python' iniciado por Stack, Agosto 6, 2025.

  1. Stack

    Stack Membro Participativo

    Create a gen_number() function that generates a phone number with code 0888 _ _ _ _ _ _. The numbers that you can generate can only contain the numbers 5, 6, 8, 0, 3, 4. Example: 0444506345

    Is it possible to do that, without import random? and how to do it with import random?

    I tried this:

    def gen_numbers(indx = '+0888',allowed = '6, 5, 8 ,0, 3, 4'):
    phones = []
    for phnmbr in range(1, 10):
    res = indx + allowed
    print(gen_numbers)


    gen_numbers()


    but output was: []

    I know that I'm doing wrong, but idk what

    Continue reading...

Compartilhe esta Página