This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import * | |
def calBMI(): | |
height = float(EntryHeight.get()) | |
weight = float(EntryWeight.get()) | |
BMI = weight / (height**2) | |
LabelBMI['text'] = BMI | |
if BMI < 18.5: | |
LabelResult['text'] = "體重過輕" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fibonacci(n): | |
if n == 1: | |
return 1 | |
elif n == 2: | |
return 2 | |
else: | |
return fibonacci(n-2) + fibonacci(n-1) | |
ans = fibonacci(50) | |
print("十階總共有 %d 種可能的走法"%ans) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getSize(){ | |
var rows = 0; | |
while(true){ | |
var nextRowGrid = document.getElementById("position-1-" + (rows+1)); | |
if(nextRowGrid){ | |
rows++ | |
}else{ | |
break; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr= []; | |
var filterArr= []; | |
var thresholdNum = 70; | |
arr.push([250,000,000,000,000,000,000,000]); | |
arr.push([000,250,000,000,000,000,000,000]); | |
arr.push([000,000,250,000,000,000,000,000]); | |
arr.push([000,000,000,250,000,000,000,000]); | |
arr.push([000,000,000,000,250,000,000,000]); | |
arr.push([000,000,000,000,000,250,000,000]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swal({ | |
title: '更新資料', | |
html: | |
'名字:'+ | |
'<input id="swal-input1" class="swal2-input" >' + | |
'年齡:'+ | |
'<input id="swal-input2" class="swal2-input" >' | |
, | |
preConfirm: function () { | |
return new Promise(function (resolve) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name":"Nick", | |
"age":22 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nums = [2,7,4,6,3]; | |
console.log("排序前:"); | |
console.log(nums); | |
console.log("排序過程:"); | |
for(var i=0;i<nums.length;i++){ | |
for(var j=1;j<nums.length;j++){ | |
if( nums[j-1] > nums[j]){ | |
var temp = nums[j]; | |
nums[j ] = nums[j-1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nums = [2,7,4,6,3]; | |
var sort_nums = []; | |
console.log("排序前:"); | |
console.log(nums); | |
console.log("排序過程:"); | |
while( nums.length>0){ | |
var min = Infinity; | |
var index = -1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hanoi(n,A,B,C){ | |
if(n == 1){ | |
console.log("從塔" + A + "移動至" + C) | |
}else{ | |
hanoi(n-1,A,C,B); | |
hanoi(1,A,B,C); | |
hanoi(n-1,B,A,C); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 創造角色 | |
var face = createSprite( ["bear.png","cat.png","cow.png"] ); | |
// 重複執行 | |
forever(function() { | |
// 如果 角色 碰觸到 滑鼠 | |
if(face.touched(cursor)) { | |
// 角色 切換下一個 造型 | |
face.nextCostume(); | |
} |
OlderNewer