portfolio.py 
home   portfolio.py

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

"""
Web browser recommended
Please scroll! ↓↓↓
"""
from datetime import date

class Human:
  def __init__(self):
    self.name = ''
    self.age = 0
    self.gender = 0
    self.job = ''

  def calculate_age(self, year, month, day):
    birth = date(year, month, day)
    today = date.today()
    age = today.year - birth.year
    # まだ今年の誕生日を迎えていないなら年齢を1減らす
    if (today.month, today.day) < (birth.month, birth.day):
      age -= 1
    return age

me = Human()
me.name = 'Ryota Shimajiri'
me.age = me.calculate_age(1992, 4, 13)
me.gender = 1 #性別(1:男 2:女)
me.job = 'Programmer + Growth hacker'

print('Nice to meet you!')
main*   Python 3.7.0 64-bit  0 0
Ln 0, Col 0  Spaces: 2  UTF-8 LF Python