生活保護基準額を計算するプログラム
Pythonで生活保護基準額を計算するプログラムを作成しました。このプログラムでは、年齢別の基準額、世帯人員数別の基準額、地区別冬季加算額を計算しています。プログラムの使用方法は、年齢をカンマ区切りで入力することで世帯人員数を自動判定し、基準額、加算額を算出します。また、地区別冬季加算額の算出も行っています。
なお、1級地1(東京都等)の基準額です。地域によってはこの額よりも少なくなります。
※経過的加算を省略しています。あくまでも概算額としてご利用ください。
# 年齢を入力
ages = input("年齢をカンマ区切りで入力してください: ")
ages_list = [int(age) for age in ages.split(",")]
household_members = len(ages_list)
# 基準額の計算
basic_allowance_1_sum = 0
basic_allowance_2_sum = 0
for age in ages_list:
if age >= 0 and age <= 2:
basic_allowance_1 = 21820
basic_allowance_2 = 44630
elif age >= 3 and age <= 5:
basic_allowance_1 = 27490
basic_allowance_2 = 44630
elif age >= 6 and age <= 11:
basic_allowance_1 = 35550
basic_allowance_2 = 45640
elif age >= 12 and age <= 17:
basic_allowance_1 = 43910
basic_allowance_2 = 47750
elif age == 18 or age == 19:
basic_allowance_1 = 43910
basic_allowance_2 = 47420
elif age >= 20 and age <= 40:
basic_allowance_1 = 42020
basic_allowance_2 = 47420
elif age >= 41 and age <= 59:
basic_allowance_1 = 39840
basic_allowance_2 = 47420
elif age >= 60 and age <= 64:
basic_allowance_1 = 37670
basic_allowance_2 = 47420
elif age >= 65 and age <= 69:
basic_allowance_1 = 37670
basic_allowance_2 = 45330
elif age >= 70 and age <= 74:
basic_allowance_1 = 33750
basic_allowance_2 = 45330
elif age >= 75:
basic_allowance_1 = 33750
basic_allowance_2 = 40920
basic_allowance_1_sum += basic_allowance_1
basic_allowance_2_sum += basic_allowance_2
# 世帯加算額の計算
if household_members == 1:
additional_allowance_1 = 45320
additional_allowance_2 = 28890
elif household_members == 2:
additional_allowance_1 = 50160
additional_allowance_2 = 42420
elif household_members == 3:
additional_allowance_1 = 55610
additional_allowance_2 = 47060
elif household_members == 4:
additional_allowance_1 = 57560
additional_allowance_2 = 49080
elif household_members == 5:
additional_allowance_1 = 58010
additional_allowance_2 = 49110
elif household_members == 6:
additional_allowance_1 = 58480
additional_allowance_2 = 56220.
elif household_members == 7:
additional_allowance_1 = 58940
additional_allowance_2 = 59190
elif household_members == 8:
additional_allowance_1 = 59390
additional_allowance_2 = 61900
elif household_members == 9:
additional_allowance_1 = 59850
additional_allowance_2 = 64380
else:
additional_allowance_1 = 59850 + (household_members - 9) * 460
additional_allowance_2 = 64380 + (household_members - 9) * 2490
# 地区別冬季加算額の計算
winter_allowance = 0
district = int(input("地区番号を入力してください(1から6の整数): "))
if district == 1:
winter_allowance = [12780, 18140, 20620, 22270, 22890][household_members-1]
elif district == 2:
winter_allowance = [9030, 12820, 14570, 15740, 16170][household_members-1]
elif district == 3:
winter_allowance = [7460, 10590, 12030, 13000, 13350][household_members-1]
elif district == 4:
winter_allowance = [6790, 9630, 10950, 11820, 12150][household_members-1]
elif district == 5:
winter_allowance = [4630, 6580, 7470, 8070, 8300][household_members-1]
elif district == 6:
winter_allowance = [2630, 3730, 4240, 4580, 4710][household_members-1]
# 基準額と加算額、冬季加算額の合計を計算
total_allowance_1 = basic_allowance_1 + additional_allowance_1 + winter_allowance
total_allowance_2 = basic_allowance_2 + additional_allowance_2 + winter_allowance
# 結果の表示
print("基準額(Ⅰ):", total_allowance_1, "円")
print("基準額(Ⅱ):", total_allowance_2, "円")