Skip to content

Instantly share code, notes, and snippets.

@masazdream
Created May 24, 2014 04:58
Show Gist options
  • Select an option

  • Save masazdream/8f65c75ecae7950b164d to your computer and use it in GitHub Desktop.

Select an option

Save masazdream/8f65c75ecae7950b164d to your computer and use it in GitHub Desktop.
初めてのPython 書式2
# coding: UTF-8
# 関数
def hello(name, num=5):
print "hello %s! " % name * num
def hello2(name, num=4):
return "hello %s!" % name * num
#pass
def hello3():
pass
hello("brain", 2)
hello("cluad", 4)
hello("david")
print hello2("mark")
# 変数スコープ
name = "imai"
def hello():
name = "mark"
print name
def double(x):
return x ** 2
print map(double, [2, 5, 8])
print map(lambda x:x * x, [2, 5, 8])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment