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 findUnpairedValue(list) : #리스트 내 쌍을 이루지 않은 정수값 | |
list.sort() #리스트 값을 정렬한다. | |
#리스트 범위 내에 2개의 값씩 서로 같은지 비교한다. | |
#이미 정렬을 했기 때문에 쌍을 이루는 값일 경우 해당 순서값과 다음값이 서로 같아야 한다. | |
#다들 경우 해당 값은 쌍을 이루지 않고 있으므로, 해당 값을 바로 리턴. | |
#시간복잡도 O(N) or O(N*log(N)) | |
cnt = len(list) | |
i = 0 | |
while i < cnt : | |
if (i+1) >= cnt or list[i] != list[i+1]: |
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
class Car(): | |
def exclaim(self): | |
print("I'm a Car!") | |
class Yugo(Car): #상속 받을 부모 클래스의 명칭을 ()에 기입 | |
def exclaim(self): | |
print("I'm a Yugo!") #method override | |
def need_a_push(self): | |
print("A little hlpe here?") #추가 선언 |
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
class Car(): | |
def exclaim(self): | |
print("I'm a Car!") | |
class Yugo(Car): #상속 받을 부모 클래스의 명칭을 ()에 기입 | |
pass | |
class Yugo2(Car): | |
def exclaim(self): #부모클래스 Car의 exclaim 메서드를 오버라이드 | |
print("I'm a Yugo2!") |
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
class Person(): | |
def __init__(self, name): | |
self.name = name | |
# __init__()은 클래스 생성자(초기화) | |
# __init__()은 모든 클래스 정의에서 선언할 필요는 없음 | |
# __init__()을 정의할 떄 반드시 첫번째 매개변수는 self | |
#__init__()을 정의할 때 첫 번째 매개변수는 self | |
hunter = Person('Tester Kim') |
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
#파이썬 네임스페이스 접근 함수 | |
#locals() 로컬 네임스페이스 내용 딕셔너리 반환 | |
#globals() 글로벌 네임스페이스 내용 딕셔너리 반환 | |
animal = 'fruitbat' | |
def change_local(): | |
animal = 'wombat' # local variable | |
print('locals:',locals()) | |
print('globals:',globals()) |
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
animal = 'fruitbat' | |
def print_global(): | |
print('inside print_global:', animal, id(animal)) | |
def change_local(): | |
animal = 'wombat_local' #지역 네임스페이스로 animal 선언 | |
print('inside change_local:', animal, id(animal)) | |
# 로컬 네임스페이스 상에 animal 이라는 변수로 새로 할당 | |
# 전역 변수와 id값이 다르다 | |
# 로컬 변수는 수행 후 함수가 종료되면 사라짐 |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>jquery mobile link test</title> | |
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.4/jquery.mobile-1.4.4.min.css" /> | |
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> | |
<script src="http://code.jquery.com/mobile/1.4.4/jquery.mobile-1.4.4.min.js"></script> | |
</head> | |
<body> |
NewerOlder