This file contains hidden or 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
| 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 변수의 내용을 화면에 출력 |
This file contains hidden or 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 haha(): | |
| a = 10 # 변수 a를 만들고 데이터 10을 저장 | |
| b = 20 # 변수 b를 만들고 데이터 20을 저장 | |
| c = 30 # 변수 c를 만들고 데이터 30을 저장 | |
| print(a) # 변수 a 출력 | |
| print(b) # 변수 b 출력 | |
| print(c) # 변수 c 출력 |
This file contains hidden or 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
| # 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) |
This file contains hidden or 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
| # plus 함수 생성 | |
| def plus(param1, param2): | |
| data = param1 + param2 # param1, param2를 더한 값을 data 변수에 저장 | |
| return data | |
| # plus 함수를 호출하고 결과 데이터를 result 변수에 저장 | |
| result = plus(10, 5) | |
| print(result) |
This file contains hidden or 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
| a = True # 변수 a에 Boolean 자료형 True 저장 | |
| b = False # 변수 b에 Boolean 자료형 False 저장 | |
| print(a) | |
| print(b) |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| print(True and True) # 둘 모두 참이므로 True | |
| print(True and False) # 둘 중 하나가 거짓이므로 False | |
| print(True or True) # 둘 중 하나가 참이므로 True (or 연산자에서 둘 모두 참인것은 의미 없음) | |
| print(True or False) # 둘 중 하나가 참이므로 True |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| for i in range(10): | |
| print(i) | |
This file contains hidden or 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 hello(name): | |
| print("Hello " + name) | |
OlderNewer