2016 


## 1


```python
e_zero = "****\n|  |\n*  *\n|  |\n****"
e_one = "*\n|\n*\n|\n*"
e_two = "****\n   |\n****\n|\n****"
e_three = "****\n   |\n****\n   |\n****"
e_four = "*  *\n|  |\n****\n   |\n   *"
e_five = "****\n|\n****\n   |\n****"
e_six = "*\n|\n****\n|  |\n****"
e_seven = "****\n   |\n   *\n   |\n   *"
e_eight = "****\n|  |\n****\n|  |\n****"
e_nine = "****\n|  |\n****\n   |\n*"   
```


```python
def num2emoji():
    num = input("enter the number >>>  ")
    row1 = ""
    row2 = ""
    row3 = ""
    row4 = ""
    row5 = ""
    for i in num:
        if i == "0":
            row1 += "****"
            row2 += "|  |"
            row3 += "*  *"
            row4 += "|  |"
            row5 += "****"
        if i == "1":
            row1 += "*"
            row2 += "|"
            row3 += "*"
            row4 += "|"
            row5 += "*"
        if i == "2":
            row1 += "****"
            row2 += "   |"
            row3 += "****"
            row4 += "|   "
            row5 += "****"
        if i == "3":
            row1 += "****"
            row2 += "   |"
            row3 += "****"
            row4 += "   |"
            row5 += "****"
        if i == "4":
            row1 += "*  *"
            row2 += "|  |"
            row3 += "****"
            row4 += "   |"
            row5 += "   *"
        if i == "5":
            row1 += "****"
            row2 += "|   "
            row3 += "****"
            row4 += "   |"
            row5 += "****"
        if i == "6":
            row1 += "*   "
            row2 += "|   "
            row3 += "****"
            row4 += "|  |"
            row5 += "****"
        if i == "7":
            row1 += "****"
            row2 += "   |"
            row3 += "   *"
            row4 += "   |"
            row5 += "   *"
        if i == "8":
            row1 += "****"
            row2 += "|  |"
            row3 += "****"
            row4 += "|  |"
            row5 += "****"
        if i == "9":
            row1 += "****"
            row2 += "|  |"
            row3 += "****"
            row4 += "   |"
            row5 += "   *"
        row1 += "  "
        row2 += "  "
        row3 += "  "
        row4 += "  "
        row5 += "  "
    return(row1[:-2]+"\n"+row2[:-2]+"\n"+row3[:-2]+"\n"+row4[:-2]+"\n"+row5[:-2])
```


```python
print(num2emoji())
```

    *  ****  ****  *  *  ****  *     ****  ****  ****  ****
    |     |     |  |  |  |     |        |  |  |  |  |  |  |
    *  ****  ****  ****  ****  ****     *  ****  ****  *  *
    |  |        |     |     |  |  |     |  |  |     |  |  |
    *  ****  ****     *  ****  ****     *  ****     *  ****



```python
output_path = "./out1.txt"

with open(output_path,"w") as f:
    f.write(num2emoji())
```

## 2


```python
with open("out1.txt", "r") as f:
    text = f.read()
    numlist = text.split("\n")
    count = ""
    
    # 繰り返し
    for i in range(len(numlist[0])):
        
        # 1のとき
        if numlist[0][0:3] == "*  " and numlist[2][0:3] == "*  ":
            count += "1"
            for i in range(len(numlist)):
                numlist[i] = numlist[i][3:]
                
        # 終了
        if numlist[0] == "":
            break
        
        # その他
        else:
            if numlist[0][0:4] == "****":
                if numlist[1][0:4] == "|  |":
                    if numlist[2][0:4] == "****":
                        if numlist[3][0:4] == "|  |":
                            count += "8"
                        else:
                            count += "9"

                    else:
                        count += "0"
                if numlist[1][0:4] == "   |":
                    if numlist[2][0:4] == "****":
                        if numlist[3][0:4] == "|   ":
                            count += "2"
                        else:
                            count += "3"
                    else:
                        count += "7"
                if numlist[1][0:4] == "|   ":
                    count += "5"
            if numlist[0][0:4] == "*  *":
                count += "4"
            if numlist[0][0:4] == "*   ":
                if numlist[1][0:4] == "|   ":
                    count += "6"
            for i in range(len(numlist)):
                numlist[i] = numlist[i][6:]

print(count)
```

    35125617051650


## 3

ここでリストにすればよかったのではという後悔が湧き上がる.

リストをつくってみたもののなんか違う・・・

普通にやる. ムリポ


```python
def num2emoji_v2():
    num = input()
    num_l = num.split(",")
    
    row_l = []
    
    max_row = int(num_l[-1])
    for i in max_row + 4:
        row_l.append("")
    
    for i in num_l[0]:
        if i == "0":
            row_l[num_l[1]] += "****"
            row_l[num_l[1] + 1] += "|  |"
            row_l[num_l[1] + 2] += "*  *"
            row_l[num_l[1] + 3] += "|  |"
            row_l[num_l[1] + 4] += "****"
            for i in range(max_row + 4):
                if len(row_l[i]) < len(row_l[num_l[1]]):
                    row_l[i] += "    "
        if i == "1":
            row1 += "*"
            row2 += "|"
            row3 += "*"
            row4 += "|"
            row5 += "*"
        if i == "2":
            row1 += "****"
            row2 += "   |"
            row3 += "****"
            row4 += "|   "
            row5 += "****"
        if i == "3":
            row1 += "****"
            row2 += "   |"
            row3 += "****"
            row4 += "   |"
            row5 += "****"
        if i == "4":
            row1 += "*  *"
            row2 += "|  |"
            row3 += "****"
            row4 += "   |"
            row5 += "   *"
        if i == "5":
            row1 += "****"
            row2 += "|   "
            row3 += "****"
            row4 += "   |"
            row5 += "****"
        if i == "6":
            row1 += "*   "
            row2 += "|   "
            row3 += "****"
            row4 += "|  |"
            row5 += "****"
        if i == "7":
            row1 += "****"
            row2 += "   |"
            row3 += "   *"
            row4 += "   |"
            row5 += "   *"
        if i == "8":
            row1 += "****"
            row2 += "|  |"
            row3 += "****"
            row4 += "|  |"
            row5 += "****"
        if i == "9":
            row1 += "****"
            row2 += "|  |"
            row3 += "****"
            row4 += "   |"
            row5 += "   *"
```