Coding the Matrix: Linear Algebra through Computer Science Applications
这是一门用python实现矩阵运算的课,第一次作业就感觉对python的提高很大,用到了各种数据类型。
代码如下:
## Task 1
minutes_in_week = 60*24*7
## Task 2
remainder_without_mod = 2304811-2304811//47*47
## Task 3
divisible_by_3 = (673+909)/3==0
## Task 4
x = -9
y = 1/2
statement_val = 2**(y+1/2) if x+10<0 else 2**(y-1/2)
## Task 5
first_five_squares = { x*x for x in {1,2,3,4,5} }
## Task 6
first_five_pows_two = { 2**x for x in {0,1,2,3,4} }
## Task 7: enter in the two new sets
X1 = { 1, 2, 3 }
Y1 = { 4, 11, 17 }
## Task 8: enter in the two new sets
X2 = { 1, 2,