Skip to content

Commit 1c63b21

Browse files
committed
first commit
0 parents  commit 1c63b21

10 files changed

Lines changed: 861 additions & 0 deletions

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 GitHub Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
[![Typing SVG](https://readme-typing-svg.herokuapp.com?color=%2336BCF7&lines=CREATE+USERS+DATA)](https://github.com/komanch7/createusersdata)
2+
---
3+
4+
### 🔥 My Stats:
5+
[![GitHub Streak](https://github-readme-streak-stats.herokuapp.com/?user=komanch7&theme=dark&background=0d1117)](https://github.com/komanch7/createusersdata/pulse)
6+
7+
- Information is presented in several languages:
8+
9+
| [German](https://github.com/komanch7/createusersdata/docs/README_DE.md) |
10+
[Russian](https://github.com/komanch7/createusersdata/docs/README_RU.md) |
11+
[Ukrainian](https://github.com/komanch7/createusersdata/docs/README_UA.md) |
12+
13+
14+
# createusersdata
15+
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
16+
17+
## Roadmap
18+
- 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
19+
20+
- create_last_name - 1. names - an array of names. 2. nationality - string value in __iso2__ format
21+
22+
- get_year_ago - the function takes one parameter (age)
23+
24+
---
25+
## Tech Stack
26+
27+
**Server:** Python 3.9^
28+
29+
---
30+
31+
# Clone this repository
32+
33+
```sh
34+
$ gh repo clone komanch7/createusersdata gp-pro
35+
36+
$ cd gh-cli
37+
38+
or
39+
40+
$ git clone https://github.com/komanch7/createusersdata gp-pro
41+
42+
$ cd gp-pro
43+
```
44+
45+
46+
47+
### JSON for data
48+
```json
49+
{"male", "female"}
50+
```
51+
```json
52+
{
53+
"male": {
54+
"en": [
55+
"Name first",
56+
"..."
57+
]
58+
},
59+
"female": {
60+
"en": [
61+
"Name first",
62+
"..."
63+
]
64+
}
65+
}
66+
```
67+
68+
### Codespaces
69+
_Python Code..._
70+
```python
71+
# all imports
72+
import create_first_name
73+
import create_last_name
74+
import get_year_ago
75+
```
76+
## Function number 1
77+
```python
78+
#
79+
res_first_name = first_name_selection(fisrt_name, gender='male', nationality='us')
80+
print(res_first_name)
81+
```
82+
- program response
83+
```python
84+
>> William
85+
```
86+
### Function number 2
87+
```python
88+
res_last_name = last_name_selection(last_name, nationality='en')
89+
90+
print(res_last_name)
91+
```
92+
- program response
93+
```python
94+
>> Berger
95+
```
96+
### Function number 3
97+
```python
98+
age = 18
99+
year_ago = get_year_ago(age)
100+
print(year_ago.strftime('%Y-%m-%d'))
101+
```
102+
- program response
103+
```python
104+
>> 2005-11-14
105+
```
106+
107+
## 🚀 About Me
108+
- I'm a beginner in Python development. Thank you for your understanding and support.
109+
---
110+
111+
## License
112+
[MIT](https://github.com/komanch7/createusersdata/LICENSE)

create_first_name.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import random
2+
import json
3+
import os
4+
5+
def get_list(path):
6+
if path != "":
7+
path = os.path.dirname(__file__) + "/" + path
8+
return json.load(open(path))
9+
#
10+
# gender = ['male', 'female']
11+
# nationality = ['en', '']
12+
def first_name_selection(names=[], gender='male', nationality='en'):
13+
if names != None and type(names) == dict:
14+
return random.choice(names[gender][nationality]) #+ " : male"
15+
elif names != None and type(names) == dict and gender == 'female':
16+
gender = 'female'
17+
nationality = 'de'
18+
return random.choice(names[gender][nationality]) #+ " : female"
19+
else:
20+
return "Enter variable \"names\"!"
21+
22+
#
23+
if __name__ == "__main__":
24+
print ("Start programm play!\n")
25+
fisrt_name = get_list("first_names.json")
26+
# print(fisrt_name)
27+
28+
res_first_name = first_name_selection(fisrt_name, gender='male', nationality='us')
29+
print(res_first_name)
30+
print ("\nEnd programm play!")
31+
else:
32+
print ("An error has occurred! Unable to start")

create_last_name.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import random
2+
import json
3+
import os
4+
from unicodedata import combining, normalize
5+
6+
def get_list(path):
7+
if path != "":
8+
path = os.path.dirname(__file__) + "/" + path
9+
return json.load(open(path))
10+
#
11+
12+
13+
14+
# nationality = ['en', 'de', 'us', 'ru', 'ua']
15+
def last_name_selection(names=[], nationality='en'):
16+
if names != None and type(names) == dict and nationality != '':
17+
return random.choice(names[nationality])
18+
elif names != None and type(names) == dict and nationality == '':
19+
nationality = 'en'
20+
return random.choice(names[nationality])
21+
else:
22+
return "Enter variable \"names\"!"
23+
#
24+
25+
26+
#
27+
if __name__ == "__main__":
28+
print ("Start programm play!\n")
29+
last_name = get_list("last_names.json")
30+
# print(last_name)
31+
32+
res_last_name = last_name_selection(last_name, nationality='de')
33+
print(res_last_name)
34+
print ("\nEnd programm play!")
35+
else:
36+
print ("An error has occurred! Unable to start")

docs/README_DE.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
[![Typing SVG](https://readme-typing-svg.herokuapp.com?color=%2336BCF7&lines=BENUTZER+DATEN+ERSTELLEN)](https://github.com/komanch7/createusersdata)
2+
---
3+
4+
### 🔥 Meine Statistiken :
5+
[![GitHub Streak](https://github-readme-streak-stats.herokuapp.com/?user=komanch7&theme=dark&background=0d1117)](https://github.com/komanch7/createusersdata/pulse)
6+
7+
- Die Informationen werden in mehreren Sprachen präsentiert:
8+
9+
| [Englisch](https://github.com/komanch7/createusersdata/README.md) |
10+
[Russisch](https://github.com/komanch7/createusersdata/docs/README_RU.md) |
11+
[Ukrainisch](https://github.com/komanch7/createusersdata/docs/README_UA.md) |
12+
13+
# createusersdata
14+
Benutzerdaten. Wenn Sie einen Namen aus einer Namensliste auswählen oder einen Nachnamen aus einer Liste mit Nachnamen auswählen, wird das Jahr basierend auf dem eingegebenen Alter berechnet.
15+
16+
## Roadmap
17+
- create_first_name – die Funktion benötigt drei Parameter. 1. Namen – ein Array von Namen. 2. Geschlecht – zwei Parameter (männlich, weiblich). 3. Nationalität – Zeichenfolgenwert im __iso2__ -Format
18+
19+
- create_last_name - 1. Namen – ein Array von Namen. 2. Nationalität – Zeichenfolgenwert im __iso2__-Format
20+
21+
- get_year_ago - Die Funktion benötigt einen Parameter (Alter)
22+
23+
---
24+
## Tech-Stack
25+
26+
**Server:** Python 3.9^
27+
28+
---
29+
30+
## Klonen Sie dieses Repository
31+
32+
```sh
33+
$ gh repo clone komanch7/createusersdata gp-pro
34+
35+
$ cd gh-cli
36+
37+
oder
38+
39+
$ git clone https://github.com/komanch7/createusersdata gp-pro
40+
41+
$ cd gp-pro
42+
```
43+
44+
45+
46+
### JSON für Daten
47+
```json
48+
{"male", "female"}
49+
```
50+
```json
51+
{
52+
"male": {
53+
"en": [
54+
"Name first",
55+
"..."
56+
]
57+
},
58+
"female": {
59+
"en": [
60+
"Name first",
61+
"..."
62+
]
63+
}
64+
}
65+
```
66+
67+
### Codespaces
68+
_Python Code..._
69+
```python
70+
# all imports
71+
import create_first_name
72+
import create_last_name
73+
import get_year_ago
74+
```
75+
## Function number 1
76+
```python
77+
#
78+
res_first_name = first_name_selection(fisrt_name, gender='male', nationality='us')
79+
print(res_first_name)
80+
```
81+
- program response
82+
```python
83+
>> William
84+
```
85+
### Function number 2
86+
```python
87+
res_last_name = last_name_selection(last_name, nationality='en')
88+
89+
print(res_last_name)
90+
```
91+
- program response
92+
```python
93+
>> Berger
94+
```
95+
### Function number 3
96+
```python
97+
age = 18
98+
year_ago = get_year_ago(age)
99+
print(year_ago.strftime('%Y-%m-%d'))
100+
```
101+
- program response
102+
```python
103+
>> 2005-11-14
104+
```
105+
106+
## 🚀 Über mich
107+
- Ich bin ein Anfänger in der Python-Entwicklung. Vielen Dank für Ihr Verständnis und Ihre Unterstützung.
108+
---
109+
110+
## Lizenz
111+
[MIT](https://github.com/komanch7/createusersdata/LICENSE)

0 commit comments

Comments
 (0)