返回列表 發帖

進位制轉換

  1. i=108
  2. print("---------------------------")
  3. print("十進制轉二進制:",bin(i))
  4. print("十進制轉八進制:",oct(i))
  5. print("十進制轉十六進制:",hex(i))
  6. print("---------------------------")
  7. print("二進制轉十進制:",int("1101100",2))
  8. print("八進制轉十進制:",int("154",8))
  9. print("十六進制轉十進制:",int("6c",16))
  10. print("---------------------------")
複製代碼
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

  1. i=108
  2. print("---------------------------")
  3. print("十進制轉二進制:",bin(i))
  4. print("十進制轉八進制:",hex(i))
  5. print("十進制轉十六進制:",oct(i))
  6. print("---------------------------")
  7. print("二進制轉十進制:",int("1101100",2))
  8. print("八進制轉十進制:",int("154",8))
  9. print("十六進制轉十進制:",int("6c",16))
  10. print("---------------------------")
複製代碼

TOP

  1. i=108
  2. print("----------------")
  3. print("十進制轉二進制:",bin(i))
  4. print("十進制轉八進制:",oct(i))
  5. print("十進制轉十六進制:",hex(i))
  6. print("----------------")
  7. print("二進制轉十進制:",int("1101100",2))
  8. print("八進制轉十進制:",int("154",8))
  9. print("十六進制轉十進制:",int("6c",16))
  10. print("----------------")
複製代碼

TOP

返回列表