Skip to content

Commit 69ebffb

Browse files
authored
Random Name Generator
1 parent 2a5aacf commit 69ebffb

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

RandomNameGen/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## Random Username Generator
2+
3+
## Packages needed
4+
- requests
5+
- randint
6+
7+
You will need a url with list names in it, next you will have to access the name by the requests, fetch the names to the terminal
8+
Use the randint to randomly pick a name and display it

RandomNameGen/user_generator.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import requests
2+
from random import randint
3+
4+
url = 'https://svnweb.freebsd.org/csrg/share/dict/propernames?revision=61766&view=co'
5+
6+
r = requests.get(url)
7+
text = r.text
8+
# print(text)
9+
10+
# We are splitting the words to clear out the empty spaces
11+
individual_word = text.split()
12+
# print(individual_word)
13+
14+
# Next we need it to extract a random name we will use random library
15+
random_number = randint(0, len(individual_word))
16+
17+
# print(individual_word[random_number])
18+
19+
#to get random word with number
20+
print(individual_word[random_number] + str(random_number))

0 commit comments

Comments
 (0)