返回列表 發帖

資料型態轉換

  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="+b)
  4. c=a+b
  5. d=int(a)+int(b)
  6. print(c)
  7. print(d)  
複製代碼

TOP

a=b"20"
print("a="+a)
print("b="+b)
c=a+b
d=int(a)+int(b)
print("字串相加: "+c)
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("b="+a)
  3. print("b="+b)
  4. c=a+b
  5. d=int(a)+int(b)
  6. print("字串相加:"+c)
  7. print("數字相加;"+str(d))
複製代碼

TOP

a=b="30"
print("a="+a)
print("b="+b)
c=a+b
d=int(a)+int(b)
print("字串相加:  "+c)
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("數字相加: ",d)
複製代碼
Allen

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))
複製代碼
Ivy

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

a=b="20"
print("a="+a)
print("b="+b)
c=a+b
d=int(a)+int(b)
print("字串相加: "+c)
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))
複製代碼
回復 4# 穆玨諺

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

返回列表