Created
August 24, 2022 15:51
-
-
Save Josephchinedu/3757d78425ef4a101d04421f84e3993e to your computer and use it in GitHub Desktop.
Generate random name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
import random | |
def generate_random_name(length): | |
VOWELS = "aeiou" | |
CONSONANTS = "".join(set(string.ascii_lowercase) - set(VOWELS)) | |
word = "" | |
for i in range(length): | |
if i % 2 == 0: | |
word += random.choice(CONSONANTS) | |
else: | |
word += random.choice(VOWELS) | |
return word | |
if __name__ == "__main__": | |
fullname = [] | |
for i in range(3): | |
fullname.append(generate_random_name(6)) | |
fullname = ' '.join(fullname) | |
print("full name: ", fullname) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment