Python Generating random names for baby girl and baby boy

 

First of all, you need to insal Faker library, then need to execute the following python code.

Faker is a Python package that generates fake data for you.

Generating random names for baby girl and baby boy

from faker import Faker

fake = Faker('en_US')  # You can adjust the locale to 'ur_PK' for Pakistani names

# Generate 500 boys' names
boys_names = [fake.first_name_male() for _ in range(500)]

# Generate 500 girls' names
girls_names = [fake.first_name_female() for _ in range(500)]

# Combine the lists
all_names = boys_names + girls_names

# Shuffle the list to make it more random
import random
random.shuffle(all_names)

# Print the first 10 names as a sample
print(all_names[:10])

 

Generating random names for girls

from faker import Faker

fake = Faker('ur_PK')  # Set the locale to 'ur_PK' for Pakistani names

# Generate 1000 girls' names
girls_names = [fake.first_name_female() for _ in range(1000)]

# Print the first 10 names as a sample
print(girls_names[:10])

Generating random names for Boys

from faker import Faker

fake = Faker('ur_PK')  # Set the locale to 'ur_PK' for Pakistani names

# Generate 1000 boys' names
boys_names = [fake.first_name_male() for _ in range(1000)]

# Print the first 10 names as a sample
print(boys_names[:10])

 

 

 

 

Contents Copyrights Reserved By T4Tutorials