# 第二堂課共筆
**2/21試題練習(虞榛)**
https://imcct.net/UserFiles/files/11%E5%B9%B4%E7%B4%9A.pdf
第3、17、18題
第一題題目

第一題解析

第一題程式碼
s=(1/2)+(2/pow(2,2))+(3/pow(2,3))+(4/pow(2,4))+(5/pow(2,5))+(6/pow(2,6))+(7/pow(2,7))+(8/pow(2,8))+(9/pow(2,9))+(10/pow(2,10))
print(s)
第二題題目

第二題解析

第二題程式碼
from math import factorial
def main ():
c=0
x=1
for i in range(1,92):
k=factorial(x)*i
x=x+1
c=c+k
print(c%2002)
main()
第三題題目

第三題解析

第三題程式碼
def main():
a=1
b=7
c=5
m=((-b+(b`*`b-4`*`a`*`c)**0.5)/2`*`a)
n=((-b-(b`*`b-4`*`a`*`c)**0.5)/2`*`a)
print((m`*`m+6`*`m+9)`*`(n`*`n+6`*`n+9))
main()
**試題練習(林益任)**
**第一題**
答案:4000000
程式碼
import math
x=(pow(2016,2)-32*2016+pow(16,2))
print(x)
**第二題**
答案:1
程式碼
import math
x=(pow(1010,2)+2`*`1010+1)/1011
y=(pow(1011,2)-1)/1012
print(x-y)
**第三題**
答案:1
程式碼
import math
x=(5-(2`*`math.sqrt(6)))
y=(math.sqrt(3)-math.sqrt(2))
z=(1/(math.sqrt(3)-math.sqrt(2)))
print(x/y*z)
**試題練習(蔣水晶)**
**第一題** 
程式碼:
import math
a= math.sqrt (5)
b= 1/math.sqrt(3)
x=pow (a+b,3)
print(x)
得:D. 22
**第一題** 
程式碼:
import math
x= math.sqrt (125)+3*5-1+pow(2,2)
print (x)
得:B. 29
**第一題** 
程式碼:
import math
x= 1/math.sqrt (5)
y= 4*pow(x,3)+2pow(x,2)-5*x+1
print (y)
得:-0.4782
**筆記**
The min() and max() functions can be used to find the lowest or highest value in an iterable
例子:
x = min(2, 3, 5,10)
y = max(2, 3, 5,10)
print(x)
print(y)
得:
2
10
The abs() function returns the absolute (positive) value of the specified number
例子
x = abs(-9)
print(x)
得:
9
The pow(x, y) function returns the value of x to the power of y (xy)
例子
notes: “Return the value of 2 to the power of 3 (same as 2 * 2 * 2)”
x = pow(2, 3)
print(x)
得:
8
When you have imported the math module (匯入math), you can start using methods and constants of the module The example for sqrt, ceil, floor, and pi.
The math.sqrt() method for example, returns the square root of a number
例子
import math
x = math.sqrt(25)
print(x)
得:
5
The math.ceil() method rounds a number upwards to its nearest integer, and the math.floor() method rounds a number downwards to its nearest integer, and returns the result
例子
import math
import math (匯入math)
#把1.4當作参數,傳入到math.ceil()函數中
#把math.ceil()運算的結果設定給x變數
x=math.ceil(1.4 )
y=math.floor(1.4)
print(x)
print(y)
得:
2
1
The math.pi constant, returns the value of PI (3.14…)
例子
import math
x = math.pi
print(x)
得:
3.141592653589793
**試題練習(王家蔚)**

第一題
x=1/-2+2/pow(-2,2)+3/pow(-2,3)+4/pow(-2,4)+5/pow(-2,5)
print(x)
答案:
第二題
x=2-pow(1/4,2)*-3
print(x)
y=4/5*x+1/2*pow(-2,3)
print(y)
第三題
x=2/5-1/8*pow(4/5,2)+-6/0.75
print(x)