張心妮{集合SET}[串列LIST](元組TUPLE){字典:DICT和集合一樣但key所以:冒號value值} 取得連結 Facebook X Pinterest 以電子郵件傳送 其他應用程式 6月 20, 2024 this=["樹","花", "草","火"] that=("元組","tuple","貓","豬","狗") print(this) for i in range(-4, 4): print(i, this[i]) for i in range(-5, 5): print(i, that[i]) 取得連結 Facebook X Pinterest 以電子郵件傳送 其他應用程式 留言
張心妮python,print,input,字串[::-1] 2月 20, 2023 w3schools學習python vs code編寫python vs code編寫python程式碼 閱讀完整內容
張心妮python時間函式time.sleep 5月 29, 2023 from tkinter import * #從函式庫 tkinter 輸入所有 * 方法 from math import * #從函式庫 math 輸入所有 * 方法 from time import * #劉任昌輸入time函數庫,取代import time class Regular: def __init__(self, cx, cy, cr, s, t, c, w): #類別共同的設定必然 def __init__ initiate發起 self.cx, self.cy, self.cr = cx, cy, cr #取得中心座標cx, cy, 半徑cr self.s, self.t = s, t #取得邊角數目s,t尖銳程度,取代原來的k = s.get() self.c, self.w = c, w #取得顏色c,寬度w self.u = 2 * pi / self.s #使用模組 math 圓周率 pi self.x, self.y = [], [] for i in range( int(self.s * 1.5)): self.x.append(self.cx + self.cr*cos(i*self.u)) self.y.append(self.cy + self.cr*sin(i*self.u)) def draw(self): #類別的方法 for i in range( int(self.s * 1.5) - self.t): canvas.create_line(self.x[i], self.y[i], self.x[i + self.t], self.y[i + self.t], fill = self.c, width = self.w) sleep(0.5) tk.update() def show(): #畫圖 define自... 閱讀完整內容
留言
張貼留言