62進数4桁の値を上2桁(Xとする)と下2桁(Yとする)
に分解し、(Xの10進数表記, Yの10進数表記)での形式で出力するよう書きたいです。
※62進数から10進数への変換:a → 10, Z → 61
※62進数2桁の場合、62の0乗の位と62の1乗の位で構成される。
※出力例)a50Y → (625, 60)
以下プログラムを書いてみましたが出力がうまくいきませんでした。
何かわかる方いましたら教えてください
python
1test = ["0","1","2","3","4","5","6","7","8","9", 2 "a","b","c","d","e","f","g","h","i","j","k","l","m","n", 3 "o","p","q","r","s","t","u","v","w","x","y","z","A","B", 4 "C","D","E","F","G","H","I","J","K","L","M","N","O","P", 5 "Q","R","S","T","U","V","W","X","Y","Z"] 6 7 8 9for XZA in test: 10 for XZA2 in test: 11 for XZA3 in test: 12 for XZA4 in test: 13 x = XZA*62+XZA2 14 y = XZA3*62+XZA4 15 print(XZA+XZA2+XZA3+XZA4+"("+x+","+y+")")
回答4件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。