返回列表 發帖

資料型態轉換

  1. a=b="20"
  2. print("a="+a)
  3. print("b="+b)
  4. c=a+b
  5. d=int(a)+int(b)
  6. print("字串相加: "+c)
  7. print("數字相加: "+str(d))
複製代碼
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

  1. a=b="20"
  2. print("a="+a)
  3. print("b="+b)
  4. c=a+b
  5. d=int(a)+int(b)
  6. print("字串相加:"+c)
  7. print("數字相加:"+str(d))
複製代碼

TOP

  1. a=b="20"
  2. print("a="+a)
  3. print("b="+b)
  4. c=a+b
  5. d=int(a)+int(b)
  6. print("字串相加:"+c)
  7. print("數字相加:"+str(d))
複製代碼

TOP

  1. a=b="20"
  2. print("a="+a)
  3. print("b="+a)
  4. c=a+b
  5. d=int(a)+int(b)
  6. print("字串相加:"+c)
  7. print("數字相加:"str(d))
複製代碼

TOP

  1. a=b="20"
  2. print("a="+a)
  3. print("b="+b)
  4. c=a+b
  5. d=int(a)+int(b)
  6. print("字串相加:"+c)
  7. print("數字相加:"+str(d))
複製代碼

TOP

  1. a=b="20"
  2. print("a="+a)
  3. print("b="+b)
  4. c=a+b
  5. d=int(a)+int(b)
  6. print("字串相加: "+c)
  7. print("數字相加: "+str(d))
複製代碼

TOP

  1. a=5
  2. b=6
  3. c=a+b
  4. print(c)
  5. c=str(a),str(b)
  6. print(c)
  7. d=int(c)+a+b
  8. print(d)
複製代碼

TOP

  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Sat Feb  1 13:10:21 2020

  4. @author: student
  5. """

  6. a="15"
  7. b="10"
  8. print("a="+a)
  9. print("b="+b)
  10. c=str(a)+str(b)
  11. c=a+b
  12. d=int(a)+int(b)
  13. print("字串相加: "+c)
  14. print("數字相加: "+str(d))
複製代碼

TOP

  1. a=b="10"
  2. print("a="+a)
  3. print("b="+b)
  4. c=a+b
  5. d=int(a)+int(b)
  6. print("字串相加:"+c)
  7. print("數字相加:"+str(d))
複製代碼

TOP

  1. a=b="20"
  2. c=a+b
  3. print("a="+a)
  4. print("b="+b)
  5. c=a+b
  6. d=int(a)+int(b)
  7. print("字串相加: "+c)
  8. print("數字相加: "+str(d))
複製代碼

TOP

  1. a=1
  2. b=2
  3. c=a+b
  4. print(c)
  5. c=str(a)+str(b)
  6. print(c)
  7. d=int(c)+a+b
  8. print(d)
複製代碼

TOP

  1. a=b="20"
  2. print("a="+a)
  3. print("b="+b)
  4. c=a+b
  5. d=int(a)+int(b)
  6. print("字串相加: "+c)
  7. print("數字相加: "+str(d))
複製代碼

TOP

  1. a = "20"

  2. b = "20"

  3. c = a+b

  4. d = int(a)+int(b)

  5. print("字串相加: "+c)

  6. print("數字相加: "+str(d))
複製代碼

TOP

  1. a=b="20"
  2. print("a="+a)
  3. print("b="+b)
  4. c=a+b
  5. d=int(a)+int(b)
  6. print("字串相加: "+c)
  7. print("數字相加: "+str(d))
複製代碼

TOP

  1. a=b="20"
  2. print("a="+a)
  3. print("b="+b)
  4. c=a+b
  5. d=int(a)+int(b)
  6. print("字串相加: "+c)
  7. print("數字相加: "+str(d))
複製代碼
陳頡鴻

TOP

  1. a=b="20"
  2. print("a="+a)
  3. print("b="+b)
  4. c=a+b
  5. d=int(a)+int(b)
  6. print("字串相加: "+c)
  7. print("數字相加: "+str(d))
複製代碼

TOP

  1. a=1
  2. b=2
  3. c=a+b
  4. print(c)
  5. c=str(a)+str(b)
  6. print(c)
  7. d=int(c)+a+b
  8. print(d)
複製代碼

TOP

返回列表