1. Configure PuTTY to make sure Chinese characters can be displayed and inputed correctly.
    1. In the PuTTY window, click the PuTTY icon at the left-upper corner of the title bar to open the system menu:
    2. Choose "Change Settings...".
    3. In the pop-up "PuTTY Reconfiguration" window, choose the item "Translation" in the left pane of "Category". Then in the drop-down list of "Received data assumed to be in which character set", choose "UTF-8".
    4. Click the button "Apply".
  2. Consider the following code:
    
    class Student :
        def __init__(self, fn, sn, language):
            self.fn = fn
            self.sn = sn
            self.language = language
    
        def __str__(self):
            if self.language == 'Chinese':
                return self.sn+ self.fn
            else:
                return self.fn + ' ' + self.sn
    
    def initGroup():
        g = []
        for s in [ Student('東坡', '蘇', 'Chinese'),
                  Student('宗元', '柳', 'Chinese'),
                  Student('Sandra', "Bullock", "English"),
                  Student('Julia', 'Roberts', "English") ]:
            g.append(s)
        return g
    
    def main():
        group = initGroup()
        for s in group:
            print(s)
    
    main()
    
    
  3. Note that this program is smart enough that it knows the different rules in displaying people's names. For Chinese names, it displays surnames (family names) before the given names (first names). For English names, it displays given names before surnames.
  4. However, the program is NOT smart enough, because you still need an instance variable to identify whether this is a Chinese name or an English name.
  5. Now we want you to modify the __str__() method of the class Student, so that it will automatically determine whether the student's name is Chinese or English. (A simple rule: If the first character of the first name is betwen 'a' to 'z', or 'A' to 'Z', we regard this as an English name. You may argue that this rule does not apply to "A妹". That's true, but let's keep it simple now.)
  6. The function initGroup() will then be simplified accordingly as
    
    def initGroup():
        g = []
        for s in [ Student('東坡', '蘇'),
                   Student('宗元', '柳'),
                   Student('Sandra', "Bullock"),
                   Student('Julia', 'Roberts') ]:
            g.append(s)
        return g
    
    
  7. Note the constructor __init__() also needs to be modified.