返回列表 發帖

資料型態轉換

  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("數字相加: ",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. print("字串相加:",a+b)
  6. d=int(a)+int(b)
  7. 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=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# tonyh

TOP

返回列表