1. Consider the following code:
    
    N = eval(input("N = ? "))
    board = ['X'*N]*2
    for i in range(N-2):
        board.insert(1, 'X'*N)
    for i in range(N):
        for j in range(N):
            print( board[i][j], end='')
        print()
    
    Modify one line so that the program will run as follows.
    
    N = ? 7
    XXXXXXX
    X     X
    X     X
    X     X
    X     X
    X     X
    XXXXXXX
    
    
    When you submit your answer, please mark the modifed line with color Magenta. For example,
    
    N = eval(input("N = ? "))
    board = []
    for i in range(N):
        board.append([' ']*N)
        board[i][i] = 'X'
        board[i][i] = 'O'
    for i in range(N):
        for j in range(N):
            print( board[i][j], end='')
        print()
    
    
  2. Consider the following code:
    
    N = eval(input("N = ? "))
    for i in range(N):
        s = '*' * (i+1)
        fmt = "{0}"
        print( fmt.format(s) )
    
    
    Modify one line so that the program will run as follows:
    
    N = ? 5
    *****
    ****
    ***
    **
    *
    
    
    When you submit your answer, please mark the updated line with color Magenta.
  3. Consider the following code:
    
    N = eval(input("N = ? "))
    for i in range(N):
        s = '*' * (2*(N-i)-1)
        print(s)
    
    
    Modify one line so that the program will run as follows:
    
    N = ? 5
    *********
     *******
      *****
       ***
        *
    
    
    When you submit your answer, please mark the updated line with color Magenta.
  4. An acronym is an abbreviation which is derived by taking the initial letter from a group of words. For example, the acronym of "World of Warcraft" is "WoW'. Design a Python function which returns the acronym of the string parameter passed to it. You may test your function with the following code:
    
    def main():
        w = ["National Chi Nan University",
            "American Standard Code Information Interchange",
            "Central Processing Unit",
            "Internet of Things",
            "Universal Serial Bus"]
        for a in w:
            print( acronym(a) )
    
    main()
    
    
  5. Design a program which asks the user to input a filename. The program will then count the occurrence of each alphabet (from 'A' to 'Z') in the file. This program will be case-insensitive, so uppercase 'A' and lowercase 'a' will look the same to it. At the end of the program, print out the statistics.
    The program may run as follows.
    
    Filename = ? test1.dat
    A: 5    B: 0    C: 0    D: 0    E: 0
    F: 0    G: 0    H: 0    I: 2    J: 0
    K: 0    L: 2    M: 1    N: 0    O: 0
    P: 0    Q: 0    R: 1    S: 2    T: 1
    U: 1    V: 0    W: 0    X: 0    Y: 2
    Z: 0
    
    
  6. Another way to create an abbreviation from a word is by deleting vowels in the word. For example, "tomato" becomes "tmt". Design a Python function vowel_delete() which returns a string by deleting vowels in the string parameter passed to it. Hint: You may use the replace() method for Python strings. You may test your function with the following code:
    
    def main():
        words = ["Greek", "German", "Spain", "KOREA", "JAPAN", "TAIWAN"]
        for w in words:
            print( vowel_delete(w) )
    main()
    
    
  7. Consider the following code:
    
    N = eval(input("N = ? "))
    for i in range(N):
        s = '*' * (N-i)
        fmt = "{0}"
        print( fmt.format(s) )
    
    
    Modify one line so that the program will run as follows:
    
    N = ? 5
    *****
     ****
      ***
       **
        *
    
    
    When you submit your answer, please mark the updated line with color Magenta.