<jupyter_start><jupyter_text>Lecture A-08$>=$ or $\ge$ greater or equal to$==$ equal to $<=$ or $\le$ less or equal to$2^3 + 5*3 - 6 +2= 19$<jupyter_code>print(3==3)
a = 3
print(a)
print(a<=3)
a = len("big muzzy") - 6
print(a)
if a > 4:
    print("a>4")
elif a > 3:
    print("a>3")
else:
    print("a<=3")<jupyter_output>3
a<=3<jupyter_text>Lecture A-09  what is an array  数组、列表indices of array  index 索引locate the position of an element  recap, if/elif/else  recap, order of computation<jupyter_code>arr = [0,1,2,3,4,5]

b = [3,8,9,7,6,6,7,8,9,0,115]
print(b[3:6])
b = ["Alan", "Bob", "Corvax", "Sylvia", "King", "Timbo"]
print(b[0:4])<jupyter_output>['Alan', 'Bob', 'Corvax', 'Sylvia']<jupyter_text>Lecture 10  slicing  slice切片 arr[a:b]recap, indices of array<jupyter_code>arr = [3,4,6,7,8,9,10,11]
print(arr[2:4])
print(arr[0:8])
print(arr[0:])
print(arr[1:])
print(arr[3:])
print(arr[4:6])
print(arr[4:])<jupyter_output>[8, 9, 10, 11]<jupyter_text>Lecture A11Range范围<jupyter_code># range(0,5)
print(list(range(0,5)))
for i in range(0,7):
    print(i)
# i = 0
# i = 1
# i = 2
# ...
# i = 6
# range(start, end)
# range(end)
list(range(5))
list(range(0,5))
name = "how does it work?"
b = len(name)
print(b)
for i in range(b):
    print(name[i])

print(name[3])<jupyter_output><jupyter_text>Lecture 12  for loop  recap, range  recap, array<jupyter_code>print(1)
print(2)
print(3)
print(4)
print(5)
i = 1
print(i)
i = 2
print(i)
i = 3
print(i)
i = 4
print(i)
i = 5
print(i)

i =1000
print(i)
for i in range(1,6):
    print(i)
for i in range(10,20):
    print(i)

arr = [1,3,5,7,9]
for i in arr:
    print(i)
cities = ["shenzhen", "united kingdom", "Germany", "guangzhou"]
for b in cities:
    print(b)
Alan  =[0,2,4,6,8,10,12,14,16,18,20]
for  c in Alan:
    print(c)
numbers = [2,3,4,5,6,7,8,9]
# calculate the squares
for i in numbers:
    print(i*i)<jupyter_output>4
9
16
25
36
49
64
81<jupyter_text>Lecture 13<jupyter_code>for i in range(10):
    for j in range(10):
        print(f"{i}x{j}={i*j}\t",end=" ")
    print("\n")
for i in range(10):
    for j in range(10):
        print(f"{i}x{j}={i*j}\t",end=" ")
    print("\n")<jupyter_output>0x0=0	 0x1=0	 0x2=0	 0x3=0	 0x4=0	 0x5=0	 0x6=0	 0x7=0	 0x8=0	 0x9=0	 

1x0=0	 1x1=1	 1x2=2	 1x3=3	 1x4=4	 1x5=5	 1x6=6	 1x7=7	 1x8=8	 1x9=9	 

2x0=0	 2x1=2	 2x2=4	 2x3=6	 2x4=8	 2x5=10	 2x6=12	 2x7=14	 2x8=16	 2x9=18	 

3x0=0	 3x1=3	 3x2=6	 3x3=9	 3x4=12	 3x5=15	 3x6=18	 3x7=21	 3x8=24	 3x9=27	 

4x0=0	 4x1=4	 4x2=8	 4x3=12	 4x4=16	 4x5=20	 4x6=24	 4x7=28	 4x8=32	 4x9=36	 

5x0=0	 5x1=5	 5x2=10	 5x3=15	 5x4=20	 5x5=25	 5x6=30	 5x7=35	 5x8=40	 5x9=45	 

6x0=0	 6x1=6	 6x2=12	 6x3=18	 6x4=24	 6x5=30	 6x6=36	 6x7=42	 6x8=48	 6x9=54	 

7x0=0	 7x1=7	 7x2=14	 7x3=21	 7x4=28	 7x5=35	 7x6=42	 7x7=49	 7x8=56	 7x9=63	 

8x0=0	 8x1=8	 8x2=16	 8x3=24	 8x4=32	 8x5=40	 8x6=48	 8x7=56	 8x8=64	 8x9=72	 

9x0=0	 9x1=9	 9x2=18	 9x3=27	 9x4=36	 9x5=45	 9x6=54	 9x7=63	 9x8=72	 9x9=81<jupyter_text>Lecture 15:  tables and 2d array  coordinates x and y<jupyter_code>A = [
    [2, 5, 7, 3, 8],
    [3, 1, 0, 2, 9],
    [2, 7, 3, 0, 4],
    [0, 1, 2, 8, 7],
    [1, 3, 5, 7, 9]
]

for i in range(4):
    for j in range(5):
        print(f"{A[i][j]}", end=" ")
    print("\n")
    
print(A[0][3])
print(A[3][2])
print(A[2][3])
print(A[1])
print(A[3])
print(A[4])<jupyter_output>2 5 7 3 8 

3 1 0 2 9 

2 7 3 0 4 

0 1 2 8 7 

3
2
0
[3, 1, 0, 2, 9]
[0, 1, 2, 8, 7]
[1, 3, 5, 7, 9]<jupyter_text>lecture 16IDE = integrated development environment   文件浏览器  项目浏览器  代码编辑器  命令行窗口  结果输出窗口  调试  断点<jupyter_code>A = [
    [2, 5, 7, 3, 8],
    [3, 1, 0, 5, 9],
    [2, 7, 3, 0, 4]
]

for i in range(3):
    for j in range(5):
        print(f"{A[i][j]}", end=" ")
    print("\n")<jupyter_output><empty_output><jupyter_text>lecture 17  flag variable while condition:    xxx    xxx<jupyter_code>hasBonbon = True
num = 10
while hasBonbon:
    print("eat a bonbon")
    num = num - 1
    if num == 0:
        hasBonbon = False
hasChips = True
num = 5
while hasChips:
    print("eat a chip")
    num -= 1 # num = num - 1
    if num == 0:
        hasChips = False

print("print by for loop:")
cities = ["guangzhou","shenzhen","shanghai","beijing","yangjiang","jiangxi"]
for i in range(len(cities)):
    print(cities[i])

print("print by while loop")
i = 0
while i<len(cities):
    print(cities[i])
    i += 1<jupyter_output><empty_output><jupyter_text>Lecture 18while loop, break  logical operators: and/or<jupyter_code>numbers = [1,3,5,7,9,11]
i = 0
while i<len(numbers):
    print(numbers[i])
    i += 1
    if i>3:
        break
a = 1
b = 3
print(a==1)
print(b==3)
print(a>0)
print(a>1)
print(b>2)
print(b>3)
print("logical operators and/or:")
print(a>0 and b>2)
print(a>1 and b>3)
print(a>0 and b>3)
print(a>0 or b>3)
print(a>1 or b>2)
print(a>1 or b>3)
numbers = [2, 0, 1, 5, 3, 7]
i = 0
while i < len(numbers):
    if numbers[i] > 3:
        print(numbers[i])
    i += 1<jupyter_output><empty_output><jupyter_text>Lecture 19applications of if, and/or  graphic basics, draw a line/circle<jupyter_code>x = 8
if x > 7 and x < 9:
    print("ok")
else:
    print("not ok")
x = 8
if x > 8 or x < 10:
    print("ok")
else:
    print("not ok")
from matplotlib import pyplot as plt
plt.figure(figsize=(5,5))
plt.xlim(0,10)
plt.ylim(0,10)
plt.xlabel("x")
plt.ylabel("y")
plt.title('a line')

x = [2,4]
y = [2,4]
plt.plot(x,y,'bo-')
plt.show()
from matplotlib import pyplot as plt
plt.figure(figsize=(5,5))
plt.xlim(0,10)
plt.ylim(0,10)
plt.xlabel("x")
plt.ylabel("y")
plt.title('a parallelogram')

x = [2,4,6,4,2]
y = [2,4,4,2,2]
plt.plot(x,y,'bo-')
plt.show()
from matplotlib import pyplot as plt
plt.figure(figsize=(5,5))
plt.xlim(0,10)
plt.ylim(0,10)
plt.xlabel("x")
plt.ylabel("y")
plt.title('a square')

x = [2,6,6,2,2]
y = [2,2,6,6,2]
plt.plot(x,y,'bo-')
plt.show()<jupyter_output><empty_output><jupyter_text>Lecture 20graphic basics, draw a star, triangle<jupyter_code>from matplotlib import pyplot as plt
plt.figure(figsize=(5,5))
plt.xlim(0,10) #x limit
plt.ylim(0,10) #y limit
plt.xlabel("x") #x label
plt.ylabel("y")
plt.title('a triangle')

x = [2,6,6,2]
y = [2,2,6,2]
plt.plot(x,y,'bo-')
plt.show()
from matplotlib import pyplot as plt
plt.figure(figsize=(5,5))
plt.xlim(0,30) #x limit
plt.ylim(0,30) #y limit
plt.xlabel("x") #x label
plt.ylabel("y")
plt.title('a triangle')

x = [5,25,15,5]
y = [5,5,20,5]
plt.plot(x,y,'bo-')
plt.show()
from matplotlib import pyplot as plt
plt.figure(figsize=(5,5))
plt.xlim(0,200)
plt.ylim(0,200)
plt.xlabel("x")
plt.ylabel("y")
plt.title('a star')

x = [100,159,5,195,41,100       ]
y = [0,181,69,69,181,0       ]
plt.plot(x,y,'bo-')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19535725052758518, 'fraction_numerical': 0.1213445884835695, 'mean_word_length': 3.9184581171237953, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 67, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '12', 'dir': 'jupyter-structured-clean-dedup', 'id': '164877', 'license': 'Apache-2.0', 'n_tokens_mistral': 3852, 'n_tokens_neox': 3449, 'n_words': 747, 'path': 'code/A01-A20.ipynb', 'repo_name': 'junyaogz/computational.math', 'size': '6634'}