Python 入門指南 V2.00 - 單元 14 範例及練習程式碼



encrypt01.py


# 定義 Encrypt 類別 
class Encrypt:
   def __init__(self):
      self.setcode()

   def setcode(self):
      self.code = "code"

   def getcode(self):
      return self.code

   # 編碼的方法
   def toEncode(self, str):
      pass

   # 解碼的方法 
   def toDecode(self, str):
      pass

# 測試部分
if __name__ == '__main__':
   e = Encrypt()
   print()
   print(e.getcode())
   print()
 
# 檔名: encrypt01.py 
# 作者: Kaiching Chang 
# 時間: July, 2014

exercise1401.py


a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]

if __name__ == "__main__":
   print(a[6])
 
# 檔名: exercise1401.py 
# 作者: Kaiching Chang 
# 時間: July, 2014

exercise1402.py


answer = 1234

if __name__ == "__main__":
   print(answer)
 
# 檔名: exercise1402.py 
# 作者: Kaiching Chang 
# 時間: July, 2014

the end

沒有留言: