티스토리 뷰

차기작 : R을 배우자

Python

quantlab 2014. 2. 15. 10:00
#01
dir(__builtins__)

#02
help(abs)

#03
5 % 2
7 % 3

#04
def increment(x):
    return x+1

#05
sent = "I\'m feeling good."
sent = "I'm feeling good."
sent = 'I\'m feeling good."

#06
print("ba"+"na"*2+"muffin.")

#07
age=input("How old are you?")

#08
def comp(n):
    if n>100:
        return "More than 100."
    elif n>10:
        return "More than 10, but equal to or less than 100."
    else:
        return "Equal to or less than 10."

#09
'mile' in 'smiles'
'smiles' in 'mile'

#10
len('Hello')

#11
s='Call Me Maybe'
s[12]
s[-1]

s[:4]

s=s[:-5]+'Perhaps'
s=s[0:-5]+'Perhaps'

#12
s.find("function")
s.count("function")
s.lower()

#13
for vowel in 'aeiou':
    print(vowel)

#14
num=6
while num>0:
    print(num)
    num=num-1

#15
temperature = [18, 20, 22.5, 24]
temperature[3]
temperature[3:]

#16
len(["math"])
len("math")

#17
grades=[80, 90, 70]
grades.append(3)
grades.pop()
grades.extend([99,77])
grades.remove(70)

#18
grades.sort()

#19
range(1,10,2)
lst=[1, 2, 3]
range(len(lst))

#20
lst=[[10,20],[15],[40,22]]
total=0
for sublist in lst:
	for num in sublist:
		total=total+num
		
#21
cat_file = open("cat.txt", "r")
cat_string= cat_file.read()

#22
import os
os.getcwd()

#23
import os
os.chdir("tempDir")

#24
tyImmutableList = (2, 3, 5)
tyDict = {'a':1, 2:'b'}

'차기작 : R을 배우자' 카테고리의 다른 글

Python and R  (0) 2014.02.15
and R  (0) 2014.02.15
문서에 들어있는 단어의 수 세기  (4) 2014.02.11
R Studio에서 View의 한글깨짐 문제  (4) 2014.02.08
구글 양식 설정 방법  (0) 2014.02.07
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함