發表文章

目前顯示的是 1月, 2026的文章

吳孟雯Javascript在瀏覽器可以執行不需要VS Code

圖片
Javascript在網頁就可以執行不需要開啟VS Code 吳孟雯執行 吳孟雯執行 以上程式碼 <STYLE>BUTTON{BORDER:GREEN 5PX SOLID;BORDER-RADIUS:30PX;}</STYLE> <h1>Javascript在網頁就可以執行不需要開啟VS Code</h1> <button onclick="LH()">王佳螢執行</button> <button onclick="LK()">王佳螢執行</button> <canvas height="400" id="my" style="background: black;" width="1200"></canvas> <script> function LH() { var c = document.getElementById("my"); var cty = c.getContext("2d"); var x = 0; var y = 200; var h = 200; cty.beginPath();  cty.lineWidth = 5;  cty.moveTo(x,y); while (x < 1000){   x = x + 1;   y = 200 - h * Math.sin(0.02*x);   cty.lineTo(x, y);   cty.strokeStyle = "yellow";   cty.stroke();    }; } function LK() { var c = document.getElementById("my"); var cty = c.getContext("2d"); var x = 0; var y = 0; var h = 200; cty.beginPath();  cty.lineWidth = 5;  cty.moveTo(x,y); whi...

甲班吳孟雯PYTHON特色:維基百科

圖片
維基百科 PYTHON 網址前後加上引號'(可以單引號'SINGLE QUOTATION MARK也可以雙引號"DOUBLE QUOTATION MARK),命令SRC=SOURCE來源,嵌入框架中FRAME這些都是HTML=HyperText Markup Language=超文件標記語言。告訴大家你也學過CSS 縮排 INDENTATION Python語法中的複合語句,包含了一些其他語句,它們以某種方式影響或控制這些其他語句的執行。Python的複合語句包含一個或多個子句(clause),子句構成自一個頭部(header)和一個套件(suite)。特定複合語句的子句頭部都在同樣的縮排層級上,每個子句頭部開始於一個唯一標識關鍵字,並結束於一個冒號。套件即語法意義上的塊,是這個子句所控制的一組語句。 Python uses whitespace indentation(使用空白鍵縮排), rather than curly brackets or keywords(而不是使用 大括號 捲的括號或關鍵字), to delimit blocks(來分隔區段). An increase in indentation comes after certain statements; a decrease in indentation signifies the end of the current block.[82] Thus, the program's visual structure accurately represents its semantic structure.[83] This feature is sometimes termed the off-side rule. Some other languages use indentation this way; but in most, indentation has no semantic meaning. The recommended indent size is four space. Python語法中的複合語句,包含了一些其他語句,它們以某種方式影響或控制這些其他語句的執行。Python的複合語句包含一個或多個子句(clause),子句...

吳孟雯甲班期末考python貪吃蛇增加進度

圖片
from tkinter import * import random GAME_WIDTH,GAME_HEIGHT = 800, 400 SPEED = 1000 #時間單位千分之一 SPACE_SIZE, BODY_PARTS= 50, 3 #左邊變數 assigning value SNAKE_COLOR = ["red","orange","yellow","green","blue","indigo", "purple"] FOOD_COLOR = "white" BACKGROUND_COLOR = "black" class Snake: def __init__(self): self.body_size = BODY_PARTS self.coordinates = [] self.squares = [] for i in range(0, BODY_PARTS): self.coordinates.append([0, 0]) for x, y in self.coordinates: i = random.randint(0,6) square = canvas.create_rectangle(x, y, x + SPACE_SIZE, y + SPACE_SIZE, fill=SNAKE_COLOR[i], tag="snake", width=20,outline='blue') self.squares.append(square) class Food: def __init__(self): x = random.randint(0, int(GAME_WIDTH / SPACE_SIZE)-1) * SPACE_SIZE y = random.randint(0, int(GAME_HEI...