返回列表 發帖

七則運算

  1. a=7
  2. b=3
  3. print("當a="+str(a)+",b="+str(b)+"時...")
  4. print("a+b="+str(a+b))
  5. print("a-b="+str(a-b))
  6. print("a*b="+str(a*b))
  7. print("a/b="+str(a/b))
  8. print("a%b="+str(a%b))    #取餘數
  9. print("a//b="+str(a//b))  #求商
  10. print("a**b="+str(a**b))  #指數運算
複製代碼
  1. a,b=7,3
  2. print("當a=%d,b=%d時..."%(a,b))
  3. print("a+b={}".format(a+b))
  4. print("a-b={}".format(a-b))
  5. print("a*b={}".format(a*b))
  6. print("a/b={}".format(a/b))
  7. print("a%b={}".format(a%b))
  8. print("a//b={}".format(a//b))
  9. print("a**b={}".format(a**b))
複製代碼

  1. a,b=7,3
  2. print("當a=%d,b=%d時..."%(a,b))
  3. print("a+b={}".format(a+b))
  4. print("a-b={}".format(a-b))
  5. print("a*b={}".format(a*b))
  6. print("a/b={}".format(a/b))
  7. print("a%b={}".format(a%b))
  8. print("a//b={}".format(a//b))
  9. print("a**b={}".format(a**b))
複製代碼

TOP

  1. a=7
  2. b=3

  3. print("當a="+str(a)+",b="+str(b)+"時...")
  4. print("a+b={}".format(a+b))
  5. print("a-b={}".format(a-b))
  6. print("a*b={}".format(a*b))
  7. print("a/b={}".format(a/b))
  8. print("a%b={}".format(a%b))   
  9. print("a//b={}".format(a//b))  
  10. print("a**b={}".format(a**b))  
複製代碼

TOP

  1. a,b=7,3
  2. print("當a="+str(a)+",b="+str(b)+"時
  3. print("a+b={}".format(a+b))      
  4. print("a-b={}".format(a-b))
  5. print("a*b={}".format(a*b))
  6. print("a\b={}".format(a\b))
  7. print("a%b={}".format(a%b))
  8. print("a\\b={}".format(a\\b))
  9. print("a**b={}".format(a**b))
複製代碼

TOP

  1. a,b=7,3
  2. print("當a=%d,b=%d時..."%(a,b))
  3. print("a+b={}".format(a+b))
  4. print("a-b={}".format(a-b))
  5. print("a*b={}".format(a*b))
  6. print("a/b={}".format(a/b))
  7. print("a%b={}".format(a%b))
  8. print("a//b={}".format(a//b))
  9. print("a**b={}".format(a**b))
複製代碼

TOP

  1. a,b=7,3
  2. print("當a="+str(a)+",b="+str(b)+"時...")
  3. print("a+b="+str(a+b))
  4. print("a-b="+str(a-b))
  5. print("a*b="+str(a*b))
  6. print("a/b="+str(a/b))
  7. print("a%b="+str(a%b))
  8. print("a//b="+str(a//b))
  9. print("a**b="+str(a**b))
複製代碼

TOP

  1. a=7
  2. b=3
  3. print("當a="+str(a)+",b="+str(b)+"時...")
  4. print("a+b="+str(a+b))
  5. print("a-b="+str(a-b))
  6. print("a*b="+str(a*b))
  7. print("a/b="+str(a/b))
  8. print("a%b="+str(a%b))
  9. print("a//b="+str(a//b))
  10. print("a**b="+str(a**b))
複製代碼

TOP

  1. a,b=7,3
  2. print("當a="+str(a)+",b="+str(b)+"時...")
  3. print("a+b="+str(a+b))
  4. print("a-b="+str(a-b))
  5. print("a*b="+str(a*b))
  6. print("a/b="+str(a/b))
  7. print("a%b="+str(a%b))
  8. print("a//b="+str(a//b))
  9. print("a**b="+str(a**b))
複製代碼

TOP

  1. a,b=7,3
  2. print("當a=%d,b=%d時..."%(a,b))
  3. print("a+b={}".format(a+b))
  4. print("a-b={}".format(a-b))
  5. print("a*b={}".format(a*b))
  6. print("a/b={}".format(a/b))
  7. print("a%b={}".format(a%b))
  8. print("a//b={}".format(a//b))
  9. print("a**b={}".format(a**b))
複製代碼

TOP

返回列表