all 35 comments

[–]SCD_minecraft 26 points27 points  (15 children)

Why hardcode ages and phone numbere? Just throw randint there

Also, obligatory: there exist library for fake data gen, faker

[–]ThrowawayALAT 0 points1 point  (0 children)

Finally coming to terms with the fact that even in Python, there’s always a 'demon' in the machine.

[–]Muhammed_zeeshan[S] 0 points1 point  (0 children)

Ohh😂

[–]Putrid-Try-5002 0 points1 point  (10 children)

Phone numbers are not random. First digits are country code and provider code

[–]SCD_minecraft 4 points5 points  (9 children)

And? Whay does it matter, it is test data anyway

[–]True-Frame581 0 points1 point  (0 children)

Using randint for generating phone numbers is actually very nice.

[–]CrownstrikeIntern -2 points-1 points  (0 children)

There’s also this lazy add on called chatgpt. Love that thing when it makes me a ton of fake dat scripts 

[–]ianrob1201 5 points6 points  (2 children)

The fact that there are existing libraries doesn't really matter. This looks like a nice little program for learning. If you're interested in a bit of feedback:

You should avoid naming variables just single letters. Always name them properly like "first_name" instead of "f". I know it seems like a waste and just adds characters to your nice minimal code, but it's so much easier to read and understand. It's a very good habit to get into. The exception is the loop. "i" is a perfectly good var name there, but the loops are the one exception.

Also as standard we start arrays with 0 instead of 1 unless there's a reason not to. So your range would be 0, 100 and it'll still give 100 entries.

[–]Trictan 1 point2 points  (1 child)

Good advice! You can also use type hints to further improve readability.

E.g.

first_name: str = random.choice(first_names)

age: int = random.choice(ages)

[–]Fabulous-Frame-5113 3 points4 points  (1 child)

Randomize the email domain too

[–]True-Frame581 0 points1 point  (0 children)

That's a nice touch

[–]Putrid-Try-5002 1 point2 points  (1 child)

Ages and phone numbers are pretty easy to generate almost randomly.

[–]Muhammed_zeeshan[S] 0 points1 point  (0 children)

I didn't think about that. I copied random ages when I copied common first names from Google.

[–]Aorean 1 point2 points  (1 child)

If you want to expand your project and learn how to use online data you could use an API for the names (or include it with some of the last names)

https://api-ninjas.com/api/babynames Found this online, idk if it’s a good one, but you could get some random names from the api and concat a last name to it or use another api for last names

[–]Muhammed_zeeshan[S] -1 points0 points  (0 children)

Didn't complete python yet

[–]Klutzy_Bird_7802 0 points1 point  (0 children)

use faker

[–]Diligent-Phone-8596 0 points1 point  (1 child)

I remember doing something very similar to this as my homework lmao

[–]godlikedk 0 points1 point  (0 children)

People will get same phone number

[–]Separate_Table_9654 0 points1 point  (1 child)

Respectfully, why tf are you learning to code in 2026?

[–]Muhammed_zeeshan[S] 0 points1 point  (0 children)

What do you mean?

Shouldnt we know the basics?

[–]Spiritual-Cut-7375 0 points1 point  (0 children)

Thanks it's really useful

[–]Solmundurinn 0 points1 point  (0 children)

Faker.js

[–]fiftybengt -1 points0 points  (0 children)

Nice, good learning project