0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

関数定義

Posted at
class Person(object):
    def say something(self)
        print('hello')
print(result)
def say_something():
    s = 'Hi'#sという変数を宣言
    return s#sをsay_somethingという関数に返す
result = say_something()#say_something()という関数を呼び出したときに何かを返して欲しい
def what_is_this(color):#colorは変数(引数)
    if color == 'red':
        return 'tomato'
    elif color == 'green':
        return 'green pepper'
    else:
        return 'I do not know.'

result = what_is_this('red')#what_is_thisという関数(function)にredという文字列を代入する
print(result)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?