Save it as name-generator.py. Now you can run the python program by pressing F5.

Name generator walk through

Lets walk through the python script, line by line.

In the first line we define our name generator function.

Then we import the random module, so we can call the random function later on.

In line define 2 arrays (color and tool) and asign values to them

Then we make 2 random numbers based on the length of our arrays. The randrage() function returns an integer in the range defined by the parameters. As parameters we use 0 and the len() function to count the numbers of words in the arrays.

In line 7 and 8 we make the final name and print it on the screen.

Finally we call the name generator function, we have just written.

That’s all it takes to make a simple Python random name generator. When you this basic functionality it’s easy to experiment and develop the random name generator to suit your needs and wishes.

Name generator inspiration

For inspiration visit the name generators where you can find a lot of name generators in several genres. From random names over fantasy and nicknames to band and business names.

Python Beginner guides and tutorials

Python is a free scripting language running on all platforms from Linux to Windows. Python is a relative easy programming language and a name generator is a simple application so it’s a good place to start if you wanna learn some programming.

If you haven’t Python installed at your computer you can download it at Python.org. This name generator script is based on python 3.12, which is the newest stable version at the moment.

4 Responses to Random name generator in Python

I like Your Website very much.Because I am trying For these kind Of programmes from many days But I didn’t get the website which give the satisfactorial answer to me.But your’s website done that
Please Give More excersises on RANDOM FUNCTION Usage.

I’m planning on making a tutorial on more complex random scripts and random algorithms to use with my name generator scripts. Won’t be in python though, but in JavaScript. But the basic principals are the same. So stay tuned. 🙂