Skip to content

Instantly share code, notes, and snippets.

View yunho0130's full-sized avatar
🎯
Focusing

Yunho Maeng yunho0130

🎯
Focusing
View GitHub Profile
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 01 17:46:04 2017
@author: Yunho
"""
def hanoi(num_disks, start_peg, temp_peg ,end_peg):
if num_disks == 1:
print '{} -> {}'.format(start_peg, end_peg)
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 03 11:44:16 2017
@author: Yunho
"""
# μ—”μ§„ μžλ™μ°¨
class NormalCar(object):
def __init__(self,input_name):
self.input_name = input_name
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 02 09:56:58 2017
@author: Yunho
"""
temp_list = ['사과', 'λ°°', 'λ”ΈκΈ°']
print temp_list
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 24 12:39:11 2016
@author: Yunho
"""
import sys
#print sys.argv[0] # prints python_script.py
#print sys.argv[1] # prints var1
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 24 12:39:11 2016
@author: Yunho
"""
# CM Lecture for Middle School Students
print "ver 1.3"
# Reflection Example
class MyClass:
def Hello(self, sText):
return 'Hello ' + sText
MyClass().Hello('Peter')
getattr(globals()['MyClass'](), 'Hello')('Peter')
# encoding=utf-8
# 2016-12-17 class
def function_test(num, val1, val2):
def minus():
print val1 - val2
def plus():
print val1 + val2
def muplti():
print val1 * val2
def division():
# coding=utf-8
def ppap(item1='pen',item2='apple',item3='pineapple'):
def song(item1):
print 'I hava a {}'.format(item1)
def ah(item1, item2):
print 'Ah~ {0} {1}'.format(item2,item1)
def combine(item1, item2, item3):
print '{0}~ {1}~ {2}~'.format(item2+' '+item1, item3+' '+item1, item1+' '+item3+' '+item2+' '+item1)
# coding=utf-8
# λ³€μˆ˜μ˜ νƒ€μž…μ„ λ°”κΏ”λ³΄μž
str = "μ˜€λŠ˜μ€ 2016λ…„ 12μ›” 11일이닀."
print str
print str[10:14]
a = str[10:14]
@yunho0130
yunho0130 / variable_test.py
Created December 11, 2016 02:39
161211 CM Korea
# coding=utf-8
a = 0 # μ „μ—­λ³€μˆ˜
def f(x): # xλŠ” λ§€κ°œλ³€μˆ˜
a = 1 # μ§€μ—­λ³€μˆ˜
x = x+2
f(2)
print a