返回列表 發帖

七則運算

  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))
複製代碼
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

本帖最後由 陳頡鴻 於 2020-2-1 14:21 編輯
  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=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=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=2
  2. b=5
  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=2
  2. b=5
  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))  
複製代碼

TOP

本帖最後由 李穎俊 於 2020-2-1 14:47 編輯
  1. x,y=7,3
  2. print("當x=%d,b=%d時..."%(x,y))
  3. print("a+b={}".format(x+y))
  4. print("a-b={}".format(x-y))
  5. print("a*b={}".format(x*y))
  6. print("a/b={}".format(x/y))
  7. print("a%b={}".format(x%y))
  8. print("a//b={}".format(x//y))
  9. print("a**b={}".format(x**y))
複製代碼
  1. x=7
  2. y=3
  3. print("當a="+str(x)+",y="+str(y)+"時...")
  4. print("x+y="+str(x+y))
  5. print("x-y="+str(x-y))
  6. print("x*y="+str(x*y))
  7. print("x/y="+str(x/y))
  8. print("x%y="+str(x%y))   
  9. print("x//y="+str(x//y))  
  10. print("x**y="+str(x**y))  
複製代碼

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=5,9
  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=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. print("當a=%d,b=%d時..."%(a,b))
  2. print("a+b={}".format(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))
複製代碼

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=%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))
複製代碼
a=7
b=3
print("當a="+str(a)+",b="+str(b)+"時...")
print("a+b="+str(a+b))
print("a-b="+str(a-b))
print("a*b="+str(a*b))
print("a/b="+str(a/b))
print("a%b="+str(a%b))   
print("a//b="+str(a//b))
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. # -*- coding: utf-8 -*-

  2. a,b=8,3
  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. # -*- coding: utf-8 -*-

  2. a=8
  3. b=3
  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=%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=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. [code][code]a = 7
  2. b = 3
  3. print("當a=%d,b=%d時..."%(a,b))
  4. print("a+b={}".format(a+b))
  5. print("a-b={}".format(a-b))
  6. print("a*b={}".format(a*b))[code]a = 7
  7. b = 3
  8. print("當a="+str(a)+",b="+str(b)+"時...")
  9. print("a+b="+str(a+b))
  10. print("a-b="+str(a-b))
  11. print("a*b="+str(a*b))
  12. print("a/b="+str(a/b))
  13. print("a%b="+str(a%b))
  14. print("a//b="+str(a//b))           
  15. print("a**b="+str(a**b))
複製代碼
print("a/b={}".format(a/b))
print("a%b={}".format(a%b))
print("a//b={}".format(a//b))
print("a**b={}".format(a**b))[/code][/code][/code]

TOP

  1. [code][code][code]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=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. x=99
  2. z=100
  3. print("當x="+str(x),"z="+str(z)+"時...")
  4. print("x+z="+str(x+z))
  5. print("x-z="+str(x-z))
  6. print("x*z="+str(x*z))
  7. print("x/z="+str(x/z))[code]x=99
  8. z=100
  9. print("當x=%d,z=%d時..."%(x,z))
  10. print("x+z={}".format(x+z))
  11. print("x-z={}".format(x-z))
  12. print("x*z={}".format(x*z))
  13. print("x/z={}".format(x/z))
  14. print("x%z={}".format(x%z))
  15. print("x//z={}".format(x//z))
  16. print("x**z={}".format(x**z))
複製代碼
print("x%z="+str(x%z))
print("x//z="+str(x//z))
print("x**z="+str(x**z))[/code]

TOP

本帖最後由 許雅棟 於 2020-2-1 14:38 編輯
  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=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=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))
複製代碼

TOP

  1. a=7
  2. b=3
  3. print("當a=%d,b=%d時..."%(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))
  10. print("a//b={}".format(a//b)
複製代碼
  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

返回列表