Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

Jupyter notebook 鄭泰然.ipynb

20 views
Kernel: Anaconda (Python 3)
import math math=input("現在幾月?") tina.width(3) tina.color("red","green") if math==1 or math==2 or math==12: tina.write("冬天") elif math==3 or math==4 or math==5: tina.write("春天") elif math==6 or math==7 or math==8: tina.write("夏天") elif math==9 or math==10 or math==11: tina.write("秋天") else: tina.write("沒有這一個月") tina.forward(-100) for i in range(1,360): tina.forward(1) tina.left(1) tina.right(90) tina.forward(100) for i in range(1,360): tina.forward(1) tina.left(1) tina.left(90) tina.forward(100) for i in range(1,10): if i / 2 ==0: tina.forward(100) tina.right(175) else: tina.forward(100) tina.right(225) tina.forward(100) tina.color("blue","white") def s(size): for i in range(4): tina.forward(size) tina.right(90) for i in range(1,200,25): s(i) def s(size): for i in range(4): tina.forward(size) tina.left(90) for i in range(1,200,25): s(i) tina.left(90) def s(size): for i in range(4): tina.forward(size) tina.left(90) for i in range(1,200,25): s(i) tina.left(90) def s(size): for i in range(4): tina.forward(size) tina.left(90) for i in range(1,200,25): s(i) def s(size,fl): if fl==1: tina.begin_fill() for i in range(4): tina.forward(size) tina.left(90) if fl==1: tina.end_fill() for i in range(1,200,25): s(i,1) tina.right(90) def s(size,fl,c1,c2): if fl==1: tina.begin_fill() tina.color((0,0,255),(255,255,255)) for i in range(4): tina.forward(size) tina.left(90) if fl==1: tina.end_fill() for i in range(1,100,10): s(i,1,"red","green") s(i,0,"red","green") def p (a,b): c=a**b return c def max(a,b): if a>b: return a else: return b a=p(2,3) c=max(10,5) d=max(3,5) print a print c print d
def score(姓名,,,): print(姓名) 平均=(++)/3 print(平均) score('周杰倫',80,80,60)
周杰倫 73.33333333333333
for i in range(1,49) print(i)
import random 開獎號=range(1,50) print("本期大樂透開獎號碼:") for n in range(1,8): 選號=random.choice(開獎號) print(選號)
import random a = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49] random.shuffle(a) a[0:7]
[23, 42, 6, 26, 10, 36, 27]
d=3 in a print(d)
if d: print("有中") else: print("沒中")
a=[] b=[] for i in range(6): ia=int(input("number==")) if 0<ia<50: b.append(ia) if b: a.append(ia) print(a) else: print("error reapeat again") else: print("error reapeat again")
number==12 [12] number==12 [12, 12] number==45 [12, 12, 45] number==23 [12, 12, 45, 23] number==64 error reapeat again number==32 [12, 12, 45, 23, 32]