User data. Selecting a name from a list of names, selecting a last name from a list of surnames, calculates the year based on the entered age
-
create_first_name - the function takes three parameters. 1. names - an array of names. 2. gender - two parameters (male, female). 3. nationality - string value in iso2 format
-
create_last_name - 1. names - an array of names. 2. nationality - string value in iso2 format
-
get_year_ago - the function takes one parameter (age). Month and day are given randomly.
Server: Python 3.9^
$ gh repo clone komanch7/createusersdata cud-pro
$ cd cud-cli
or
$ git clone https://github.com/komanch7/createusersdata cud-pro
$ cd cud-pro
{"male", "female"}
{
"male": {
"en": [
"Name first",
"..."
]
},
"female": {
"en": [
"Name first",
"..."
]
}
}
Python Code...
# all imports
import create_first_name
import create_last_name
import get_year_ago
# get list
first_name = "first_names.json"
# takes three parameters
# 1. list with named
# 2. string with gender
# 3. string with Name nationality (optional)
res_first_name = first_name_selection(fisrt_name, gender='male', nationality='us')
print(res_first_name)
- program response
>> William
# get list
last_name = "last_names.json"
# takes three parameters
# 1. list with named
# 2. string with Name nationality (optional), default parameter = 'en'
res_last_name = last_name_selection(last_name, nationality='en')
print(res_last_name)
- program response
>> Berger
# takes one parameter
# 1. integer with age
age = 18
year_ago = get_year_ago(age)
print(year_ago.strftime('%Y'))
- program response
>> 2005
- I'm a beginner in Python development. Thank you for your understanding and support.