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
#!/usr/bin/python | |
# ?A?B猜數字遊戲 | |
# 可選擇一到九位數來進行猜數字,數字可重複 | |
from tkinter import Tk, Label, Entry, Spinbox, Button, messagebox, StringVar | |
from random import randint | |
answer = "" | |
playerGuess = "" | |
nOfDigits = 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
#include "Math.h" | |
void setup() { | |
Serial.begin(9600); | |
} | |
void loop() { | |
float angle = 0; | |
float sineData; | |
float cosineData; |
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
----------------------------------------------------------------------------------------- | |
-- | |
-- main.lua | |
-- | |
----------------------------------------------------------------------------------------- | |
local score = 0 | |
local background = display.newImageRect( "background.png", 360, 570 ) | |
background.x = display.contentCenterX | |
background.y = display.contentCenterY |
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
#!/usr/bin/python | |
# 步驟一:匯入 tkinter 模組。 | |
from tkinter import Tk, Label, Entry, Radiobutton, IntVar | |
# 步驟二:建立主視窗。 | |
mainWin = Tk() | |
var = IntVar() | |
operation = [ '+', '-', '*', '/'] |
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
# -*- coding: utf-8 -*- | |
import numpy as np | |
import matplotlib.pyplot as plt | |
# 產生x座標的資料,從 -PI 到 PI | |
X = np.linspace(-np.pi, np.pi, 260, endpoint=True) | |
# Y座標 | |
Cos_y, Sin_y = np.cos(X), np.sin(X) | |
Tan_y = np.tan(X) |
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
// set pin numbers joystick axes | |
const int xAxis = A0; // joystick X axis | |
const int yAxis = A1; // joystick Y axis | |
int responseDelay = 50; // response delay of the mouse, in ms | |
const int centerValue = 512; | |
const int range = 200; | |
const int upperBond = centerValue + range; | |
const int lowerBond = centerValue - range; |
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
import math; | |
def eratosthenes(n): | |
P = [i for i in range(2, (int)(math.sqrt(n)+1))] | |
p = 0 | |
while True: | |
for i in P[p + 1:]: | |
if i % P[p] == 0: | |
P.remove(i) | |
if P[p]**2 >= P[-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
def prime_factoring(n): | |
divisor = 2 | |
factors = [] | |
while divisor * divisor <= n: | |
if n % divisor: | |
divisor += 1 | |
else: | |
n //= divisor | |
factors.append(divisor) |
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
import random | |
from collections import deque | |
unsortData = random.sample(range(100), 10) | |
def merge_sort(lst): | |
if len(lst) <= 1: | |
return lst | |
def merge(left, right): |