Skip to content

Instantly share code, notes, and snippets.

@ttns1
ttns1 / test.py
Last active May 4, 2019 01:43
python
msg1 = "message 1" # msg1 변수에 "message 1" 문자열을 저장
msg2 = "message 2" # msg2 변수에 "message 2" 문자열을 저장
msg3 = msg1 + msg2 # msg3 변수에 msg1, msg2 변수를 더한 값을 저장
print(msg1) # print 함수를 호출하여 msg1 변수의 내용을 화면에 출력
print(msg2) # print 함수를 호출하여 msg2 변수의 내용을 화면에 출력
@ttns1
ttns1 / func.py
Last active February 11, 2019 13:59
func
def haha():
a = 10 # 변수 a를 만들고 데이터 10을 저장
b = 20 # 변수 b를 만들고 데이터 20을 저장
c = 30 # 변수 c를 만들고 데이터 30을 저장
print(a) # 변수 a 출력
print(b) # 변수 b 출력
print(c) # 변수 c 출력
@ttns1
ttns1 / fff.py
Last active February 11, 2019 15:24
fff
# test 함수 생성
def test(param1, param2):
plus = param1 + param2 # param1, param2를 더한 값을 plus 변수에 저장
minus = param1 - param2 # param1, param2를 뺀 값을 minus 변수에 저장
print(plus) # plus 변수 출력
print(minus) # minus 변수 출력
# 10과 5를 파라미터로 전달하며 test 함수 호출
test(10, 5)
@ttns1
ttns1 / fff.py
Last active February 11, 2019 15:30
ㅊㅊ
# plus 함수 생성
def plus(param1, param2):
data = param1 + param2 # param1, param2를 더한 값을 data 변수에 저장
return data
# plus 함수를 호출하고 결과 데이터를 result 변수에 저장
result = plus(10, 5)
print(result)
@ttns1
ttns1 / fef.py
Created February 12, 2019 07:36
ffe
a = True # 변수 a에 Boolean 자료형 True 저장
b = False # 변수 b에 Boolean 자료형 False 저장
print(a)
print(b)
@ttns1
ttns1 / fzx.py
Created February 12, 2019 07:58
wef
print(1 == 2) # 1과 2는 같은가? ==> False
print(1 != 2) # 1과 2는 다른가? ==> True
print(1 > 2) # 1은 2보다 큰가? ==> False
print(1 < 2) # 1은 2보다 작은가? ==> True
print(1 >= 2) # 1은 2보다 크거나 같은가? ==> False
print(1 <= 2) # 1은 2보다 작거나 같은가? ==> True
@ttns1
ttns1 / rdfgf.py
Created February 12, 2019 08:50
ergregerg
print(True and True) # 둘 모두 참이므로 True
print(True and False) # 둘 중 하나가 거짓이므로 False
print(True or True) # 둘 중 하나가 참이므로 True (or 연산자에서 둘 모두 참인것은 의미 없음)
print(True or False) # 둘 중 하나가 참이므로 True
@ttns1
ttns1 / ergerg.py
Created February 12, 2019 09:09
ㄷㄱㅎ
print(1 < 2 and 3 < 4) # True and True 이므로 True
print(1 > 2 and 3 < 4) # False and True 이므로 False
print(1 == 2 and 3 == 4) # False and False 이므로 False
print(1 < 2 or 3 < 4) # True or True 이므로 True
print(1 > 2 or 3 < 4) # False or True 이므로 True
print(1 == 2 or 3 == 4) # False or False 이므로 False
@ttns1
ttns1 / ji3jrr.py
Last active February 12, 2019 14:01
234234
for i in range(10):
print(i)
@ttns1
ttns1 / testmodule.py
Last active February 13, 2019 01:36
dgrg
def hello(name):
print("Hello " + name)