Skip to content

Instantly share code, notes, and snippets.

View bryanyang0528's full-sized avatar
🎯
Focusing

Bryan Yang bryanyang0528

🎯
Focusing
View GitHub Profile
cellMicky = monocell("micky",5)
cellMini = monocell("Kini",7)
#cellLucky = monocell("Lucky",15)
cellMicky.start()
cellMini.start()
myLand.printLand(land)
class monocell(threading.Thread):
lifeCost = 1
def __init__(self,name,life):
threading.Thread.__init__(self)
self.birthTime = datetime.datetime.now()
self.name = name
self.life = life
def run(self):
## create the map
land=[]
class Myland:
##建立一個場景物件
def creatLand(self,size,symbol):
#這邊有兩個參數,size決定邊長,symbol可讓使用者自行輸入想要的圖示
self.symbol = str(symbol) ##不管使用者輸入什麼都轉成str
for i in range(size):##用for迴圈做出i個row
import datetime
import time
from threading import Thread
##導入thread物件
class monocell(Thread):
##要將物件轉成多執行緒物件的方式就是在創立物件時繼承Thread
lifeCost = 1
good_ing <- sqldf("
SELECT a.*,b.max,
CASE #這一段是說用max來recode變項
WHEN b.max >= 80 THEN '80up' #
WHEN b.max >= 60 and b.max < 80 THEN '60-80' #
WHEN b.max >= 40 and b.max < 60 THEN '40-60' #
WHEN b.max < 40 THEN '40under' #
END AS ingLevel #<--將recode的變項重新命名
FROM goodInfo as a,
(SELECT id, max(per) as max
library("sqldf")
x <- sqldf("
SELECT gender, age, sum(icome)
FROM client
GROUP BY gender, age
ORDER BY gender, age
")
>>> s = list("Hello zorld")
>>> s
['H', 'e', 'l', 'l', 'o', ' ', 'z', 'o', 'r', 'l', 'd']
>>> s[6] = 'W'
>>> s
['H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd']
>>> "".join(s)
'Hello World'
text = "AbCdEf"
text1 = ""
for i in range(len(text)):
if i == 0:
text1 += text[i].lower()
else:
text1 += text[i]
print text1
text = "AbCdEf"
text[0] = "1"
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-10-639914bf643c> in <module>()
1
2 text = "AbCdEf"
----> 3 text[0] = "1"
{
"metadata": {
"name": "",
"signature": "sha256:d0e70bba76e533c765aa57c9511a49d143a281d7ab469d94c5c12b1f34eb3f77"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [