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
https://jsfiddle.net/afyY2/37/ |
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 parameter_local_variable_test(a): | |
print("init : ", hex(id(a))) | |
a = 10 | |
print("assign 10 to a : ", hex(id(a))) | |
a = 5 | |
print("assign different value : ", hex(id(a))) | |
a = 5 | |
print("same value : " ,hex(id(a))) | |
# >>> test(10) |
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 merge(array1, array2): | |
a_index = 0 | |
b_index = 0 | |
result = [] | |
while a_index < len(array1) or b_index < len(array2): | |
if a_index >= len(array1) or array1[a_index] > array2[b_index]: | |
result.append(array2[b_index]) | |
b_index+=1 | |
elif b_index >= len(array2) or array1[a_index] <= array2[b_index]: | |
result.append(array1[a_index]) |
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 merge(array1, array2): | |
a_index = 0 | |
b_index = 0 | |
result = [] | |
# wrong while condition | |
while a_index < len(array1) and b_index < len(array2): | |
if array1[a_index] > array2[b_index]: | |
result.append(array2[b_index]) | |
b_index+=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
import json | |
from app.models import People | |
from django.http import HttpResponse | |
def add_peoples(request, room_id): | |
# request.body = '{"peoples": [{name:'a', phone:'001010}, {....}, {....}]}' | |
json_peoples = json.loads(request.body) | |
for json_people in json_peoples["peoples"]: | |
# room is real field name. _id is attr. | |
people = People.objects.create(name=json_people['name'], phone=json_people['phone'], room_id=room_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
set output-meta on | |
set convert-meta off |
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
set tenc=korea | |
set enc=utf-8 |
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 sort(a, b): | |
a_index=0 | |
b_index=0 | |
result = [] | |
while a_index < len(a) or b_index < len(b): | |
if b_index >= len(b): | |
result.append(a[a_index]) | |
a_index+=1 | |
elif a_index >= len(a): | |
result.append(b[b_index]) |
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 mergeSort(alist): | |
print("Splitting ", alist) | |
if len(alist)>1: | |
mid = len(alist)//2 | |
lefthalf = alist[:mid] | |
righthalf = alist[mid:] | |
mergeSort(lefthalf) | |
mergeSort(righthalf) |
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
> pip3 install virtualenv # 3.x의 python library virtualenv 설치 | |
> python3 -m venv myenv # python3 환경을 virtual environment를 myenv 폴더에 셋팅 | |
> myenv\Scripts\activate.bat # python3 가상 환경을 적용 | |
> deactivate.bat # 가상 환경 해제 |