Spaces:
Sleeping
Sleeping
capitals = { | |
"MgCl2": "塩化マグネシウム", | |
"MgO": "酸化マグネシウム", | |
"MgF2": "フッ化マグネシウム", | |
"MgS": "硫化マグネシウム", | |
"Mg(OH)2": "水酸化マグネシウム", | |
"MgI2": "ヨウ化マグネシウム", | |
"CaCl2": "塩化カルシウム", | |
"CaO": "酸化カルシウム", | |
"CaF2": "フッ化カルシウム", | |
"CaS": "硫化カルシウム", | |
"Ca(OH)2": "水酸化カルシウム", | |
"CaI2": "ヨウ化カルシウム", | |
"ZnCl2": "塩化亜鉛", | |
"ZnO": "酸化亜鉛", | |
"ZnF2": "フッ化亜鉛", | |
"ZnS": "硫化亜鉛", | |
"Zn(OH)2": "水酸化亜鉛", | |
"ZnI2": "ヨウ化亜鉛", | |
"NaCl": "塩化ナトリウム", | |
"Na2O": "酸化ナトリウム", | |
"NaF": "フッ化ナトリウム", | |
"Na2S": "硫化ナトリウム", | |
"NaOH": "水酸化ナトリウム", | |
"NaI": "ヨウ化ナトリウム", | |
"KCl": "塩化カリウム", | |
"K2O": "酸化カリウム", | |
"KF": "フッ化カリウム", | |
"K2S": "硫化カリウム", | |
"KOH": "水酸化カリウム", | |
"KI": "ヨウ化カリウム", | |
"HCl": "塩化水素", | |
"H2O": "水", | |
"HF": "フッ化水素", | |
"H2S": "硫化水素", | |
"HOH": "水(H2Oでない)", | |
"HI": "ヨウ化水素", | |
"CuCl": "塩化銅(I)", | |
"Cu2O": "酸化銅(I)", | |
"CuF": "フッ化銅(I)", | |
"Cu2S": "硫化銅(I)", | |
"CuOH": "水酸化銅(I)", | |
"CuI": "ヨウ化銅(I)", | |
"CuCl2": "塩化銅(II)", | |
"CuO": "酸化銅(II)", | |
"CuF2": "フッ化銅(II)", | |
"CuS": "硫化銅(II)", | |
"Cu(OH)2": "水酸化銅(II)", | |
"CuI2": "ヨウ化銅(II)", | |
"AgCl": "塩化銀", | |
"Ag2O": "酸化銀", | |
"AgF": "フッ化銀", | |
"Ag2S": "硫化銀", | |
"AgOH": "水酸化銀", | |
"AgI": "ヨウ化銀", | |
"BaCl2": "塩化バリウム", | |
"BaO": "酸化バリウム", | |
"BaF2": "フッ化バリウム", | |
"BaS": "硫化バリウム", | |
"Ba(OH)2": "水酸化バリウム", | |
"BaI2": "ヨウ化バリウム", | |
"FeCl2": "塩化鉄(II)", | |
"FeO": "酸化鉄(II)", | |
"FeF2": "フッ化鉄(II)", | |
"FeS": "硫化鉄(II)", | |
"Fe(OH)2": "水酸化鉄(II)", | |
"FeI2": "ヨウ化鉄(II)", | |
"MnCl2": "塩化マンガン(II)", | |
"MnO": "酸化マンガン(II)", | |
"MnF2": "フッ化マンガン(II)", | |
"MnS": "硫化マンガン(II)", | |
"Mn(OH)2": "水酸化マンガン(II)", | |
"MnI2": "ヨウ化マンガン(II)", | |
"PbCl2": "塩化鉛(II)", | |
"PbO": "酸化鉛(II)", | |
"PbF2": "フッ化鉛(II)", | |
"PbS": "硫化鉛(II)", | |
"Pb(OH)2": "水酸化鉛(II)", | |
"PbI2": "ヨウ化鉛(II)", | |
"AlCl3": "塩化アルミニウム", | |
"Al2O3": "酸化アルミニウム", | |
"AlF3": "フッ化アルミニウム", | |
"Al2S3": "硫化アルミニウム", | |
"Al(OH)3": "水酸化アルミニウム", | |
"AlI3": "ヨウ化アルミニウム", | |
"FeCl3": "塩化鉄(III)", | |
"Fe2O3": "酸化鉄(III)", | |
"FeF3": "フッ化鉄(III)", | |
"Fe2S3": "硫化鉄", | |
"Fe(OH)3": "水酸化鉄(III)", | |
"FeI3": "ヨウ化鉄(III)", | |
"NH4Cl": "塩化アンモニウム", | |
"(NH4)2O": "酸化アンモニウム", | |
"NH4F": "フッ化アンモニウム", | |
"(NH4)2S": "硫化アンモニウム", | |
"NH4OH": "水酸化アンモニウム", | |
"NH4I": "ヨウ化アンモニウム", | |
"MgSO4": "硫酸マグネシウム", | |
"MgCO3": "炭酸マグネシウム", | |
"MgC2O4": "シュウ酸マグネシウム", | |
"MgCrO4": "クロム酸マグネシウム", | |
"MgCr2O7": "二クロム酸マグネシウム", | |
"MgS2O3": "チオ硫酸マグネシウム", | |
"Mg3(PO4)2": "リン酸マグネシウム", | |
"CaSO4": "硫酸カルシウム", | |
"CaCO3": "炭酸カルシウム", | |
"CaC2O4": "シュウ酸カルシウム", | |
"CaCrO4": "クロム酸カルシウム", | |
"CaCr2O7": "二クロム酸カルシウム", | |
"CaS2O3": "チオ硫酸カルシウム", | |
"Ca3(PO4)2": "リン酸カルシウム", | |
"ZnSO4": "硫酸亜鉛", | |
"ZnCO3": "炭酸亜鉛", | |
"ZnC2O4": "シュウ酸亜鉛", | |
"ZnCrO4": "クロム酸亜鉛", | |
"ZnCr2O": "二クロム酸亜鉛", | |
"ZnS2O3": "チオ硫酸亜鉛", | |
"Zn3(PO4)2": "リン酸亜鉛", | |
"Na2SO4": "硫酸ナトリウム", | |
"Na2CO3": "炭酸ナトリウム", | |
"Na2C2O4": "シュウ酸ナトリウム", | |
"Na2CrO4": "クロム酸ナトリウム", | |
"Na2Cr2O7": "二クロム酸ナトリウム", | |
"Na2S2O3": "チオ硫酸ナトリウム", | |
"Na3PO4": "リン酸ナトリウム", | |
"K2SO4": "硫酸カリウム", | |
"K2CO3": "炭酸カリウム", | |
"K2C2O4": "シュウ酸カリウム", | |
"K2CrO4": "クロム酸カリウム", | |
"K2Cr2O7": "二クロム酸カリウム", | |
"K2S2O3": "チオ硫酸カリウム", | |
"K3PO4": "リン酸カリウム", | |
"H2SO4": "硫酸", | |
"H2CO3": "炭酸", | |
"H2C2O4": "シュウ酸", | |
"H2CrO4": "クロム酸", | |
"H2Cr2O7": "二クロム酸", | |
"H2S2O3": "チオ硫酸", | |
"H3PO4": "リン酸", | |
"Cu2SO4": "硫酸銅(I)", | |
"Cu2CO3": "炭酸銅(I)", | |
"Cu2C2O4": "シュウ酸銅(I)", | |
"Cu2CrO4": "クロム酸銅(I)", | |
"Cu2Cr2O7": "二クロム酸銅(I)", | |
"Cu2S2O3": "チオ硫酸銅(I)", | |
"Cu3PO4": "リン酸銅(I)", | |
"CuSO4": "硫酸銅(II)", | |
"CuCO3": "炭酸銅(II)", | |
"CuC2O4": "シュウ酸銅(II)", | |
"CuCrO4": "クロム酸銅(II)", | |
"CuCr2O7": "二クロム酸銅(II)", | |
"CuS2O3": "チオ硫酸銅(II)", | |
"Cu3(PO4)2": "リン酸銅(II)", | |
"Ag2SO4": "硫酸銀", | |
"Ag2CO3": "炭酸銀", | |
"Ag2C2O4": "シュウ酸銀", | |
"Ag2CrO4": "クロム酸銀", | |
"Ag2Cr2O7": "二クロム酸銀", | |
"Ag2S2O3": "チオ硫酸銀", | |
"Ag3PO4": "リン酸銀", | |
"BaSO4": "硫酸バリウム", | |
"BaCO3": "炭酸バリウム", | |
"BaC2O4": "シュウ酸バリウム", | |
"BaCrO4": "クロム酸バリウム", | |
"BaCr2O7": "二クロム酸バリウム", | |
"BaS2O3": "チオ硫酸バリウム", | |
"Ba3(PO4)2": "リン酸バリウム", | |
"FeSO4": "硫酸鉄(II)", | |
"FeCO3": "炭酸鉄(II)", | |
"FeC2O4": "シュウ酸鉄(II)", | |
"FeCrO4": "クロム酸鉄(II)", | |
"FeCr2O7": "二クロム酸鉄(II)", | |
"FeS2O3": "チオ硫酸鉄(II)", | |
"Fe3(PO4)2": "リン酸鉄(II)", | |
"MnSO4": "硫酸マンガン(II)", | |
"MnCO3": "炭酸マンガン(II)", | |
"MnC2O4": "シュウ酸マンガン(II)", | |
"MnCrO4": "クロム酸マンガン(II)", | |
"MnCr2O": "二クロム酸マンガン(II)", | |
"MnS2O3": "チオ硫酸マンガン(II)", | |
"Mn3(PO4)2": "リン酸マンガン(II)", | |
"PbSO4": "硫酸鉛(II)", | |
"PbCO3": "炭酸鉛(II)", | |
"PbC2O4": "シュウ酸鉛(II)", | |
"PbCrO4": "クロム酸鉛(II)", | |
"PbCr2O7": "二クロム酸鉛(II)", | |
"PbS2O3": "チオ硫酸鉛(II)", | |
"Pb3(PO4)2": "リン酸鉛(II)", | |
"Al2(SO4)3": "硫酸アルミニウム", | |
"Al2(CO3)3": "炭酸アルミニウム", | |
"Al2(C2O4)3": "シュウ酸アルミニウム", | |
"Al2(CrO4)3": "クロム酸アルミニウム", | |
"Al2(Cr2O7)3": "二クロム酸アルミニウム", | |
"Al2(S2O3)3": "チオ硫酸アルミニウム", | |
"AlPO4": "リン酸アルミニウム", | |
"Fe2(SO4)3": "硫酸鉄(III)", | |
"Fe2(CO3)3": "炭酸鉄(III)", | |
"Fe2(C2O4)3": "シュウ酸鉄(III)", | |
"Fe2(CrO4)3": "クロム酸鉄(III)", | |
"Fe2(Cr2O7)3": "二クロム酸鉄(III)", | |
"Fe2(S2O3)3": "チオ硫酸鉄(III)", | |
"FePO4": "リン酸鉄(III)", | |
"Mg(NO3)2": "硝酸マグネシウム", | |
"(CH3COO)2Mg": "酢酸マグネシウム", | |
"Mg(MnO4)2": "過マンガン酸マグネシウム", | |
"Ca(NO3)2": "硝酸カルシウム", | |
"(CH3COO)2Ca": "酢酸カルシウム", | |
"Ca(MnO4)2": "過マンガン酸カルシウム", | |
"Zn(NO3)2": "硝酸亜鉛", | |
"(CH3COO)2Zn": "酢酸亜鉛", | |
"Zn(MnO4)2": "過マンガン酸亜鉛", | |
"NaNO3": "硝酸ナトリウム", | |
"CH3COONa": "酢酸ナトリウム", | |
"NaMnO4": "過マンガン酸ナトリウム", | |
"KNO3": "硝酸カリウム", | |
"CH3COOK": "酢酸カリウム", | |
"KMnO4": "過マンガン酸カリウム", | |
"HNO3": "硝酸", | |
"CH3COOH": "酢酸", | |
"HMnO4": "過マンガン酸", | |
"CuNO3": "硝酸銅(I)", | |
"CuMnO4": "過マンガン酸銅(I)", | |
"Cu(NO3)2": "硝酸銅(II)", | |
"(CH3COO)2Cu": "酢酸銅(II)", | |
"Cu(MnO4)2": "過マンガン酸銅(II)", | |
"AgNO3": "硝酸銀", | |
"CH3COOAg": "酢酸銀", | |
"AgMnO4": "過マンガン酸銀", | |
"Ba(NO3)2": "硝酸バリウム", | |
"(CH3COO)2Ba": "酢酸バリウム", | |
"Ba(MnO4)2": "過マンガン酸バリウム", | |
"Fe(NO3)2": "硝酸鉄(II)", | |
"(CH3COO)2Fe": "酢酸鉄(II)", | |
"Fe(MnO4)2": "過マンガン酸鉄(II)", | |
"Mn(NO3)2": "硝酸マンガン(II)", | |
"(CH3COO)2Mn": "酢酸マンガン(II)", | |
"MnNO3": "硝酸マンガン(I)", | |
"CH3COOMn": "酢酸マンガン(I)", | |
"Mn(MnO4)2": "過マンガン酸マンガン(II)", | |
"Pb(NO3)2": "硝酸鉛(II)", | |
"(CH3COO)2Pb": "酢酸鉛(II)", | |
"Pb(MnO4)2": "過マンガン酸鉛(II)", | |
"Al(NO3)3": "硝酸アルミニウム", | |
"(CH3COO)3Al": "酢酸アルミニウム", | |
"Al(MnO4)3": "過マンガン酸アルミニウム", | |
"Fe(NO3)3": "硝酸鉄(III)", | |
"(CH3COO)3Fe": "酢酸鉄(III)", | |
"Fe(MnO4)3": "過マンガン酸鉄(III)", | |
"Mn(NO3)3": "硝酸マンガン(III)", | |
"(CH3COO)3Mn": "酢酸マンガン(III)", | |
"Mn(MnO4)3": "過マンガン酸マンガン(III)", | |
"Pb(NO3)3": "硝酸鉛(III)", | |
"(CH3COO)3Pb": "酢酸鉛(III)", | |
"Pb(MnO4)3": "過マンガン酸鉛(III)", | |
"Fe(NO3)2": "硝酸鉄(II)", | |
"(CH3COO)2Fe": "酢酸鉄(II)", | |
"Fe(MnO4)2": "過マンガン酸鉄(II)", | |
"Mn(NO3)2": "硝酸マンガン(II)", | |
"(CH3COO)2Mn": "酢酸マンガン(II)", | |
"Mn(MnO4)2": "過マンガン酸マンガン(II)", | |
"Pb(NO3)2": "硝酸鉛(II)", | |
"(CH3COO)2Pb": "酢酸鉛(II)", | |
"Pb(MnO4)2": "過マンガン酸鉛(II)", | |
} | |
# -*- coding: utf-8 -*- | |
from flask import Flask, render_template, request, redirect, url_for, session | |
import random | |
app = Flask(__name__) | |
app.secret_key = 'your_secret_key_here' # セッションの安全な署名に必要なキー | |
def get_random_country(): | |
country = random.choice(list(capitals.keys())) | |
return country, capitals[country] | |
def quiz(): | |
if 'current_化合物' not in session: # セッションに現在の化合物がない場合は新しいものを取得 | |
session['current_化合物'], session['current_化合物名'] = get_random_country() | |
result = None | |
if request.method == 'POST': | |
user_input = request.form['user_input'] | |
if user_input == session['current_化合物']: | |
result = '正解です!' | |
else: | |
result = '不正解です。正解は{}です。'.format(session['current_化合物']) | |
return render_template('quiz.html', element=session['current_化合物名'], result=result) | |
def next_question(): | |
session.pop('current_化合物') # 現在の化合物をセッションから削除 | |
session.pop('current_化合物名') | |
return redirect(url_for('quiz')) | |
if __name__ == '__main__': | |
app.run(debug=True, port=7860, host="0.0.0.0") |