ことりん

ことりん

記事一覧

React環境構築 つまづきメモ

Node.jsインストール後、npx create-app d PS C:\Users\kaopp\React_test> npx create-react-app react-basicnpm ERR! code ENOENTnpm ERR! syscall lstatnpm ERR! path C…

ことりん
11か月前
1

Python入門 関数内関数、クロージャー、デコレーター

# 関数内関数def outer(a, b): def plus(c, d): return c + d r1 = plus(a, b) r2 = plus(b, a) print(r1 + r2)outer(1, 2)# クロージャー# def outer(a, b)…

ことりん
4年前

Python入門 キーワード引数の辞書化

# キーワード引数の辞書化# def menu(entree='beef', drink='wine'):# print(entree, drink)"""def menu(**kwargs): # print(kwargs) for k, v in kwargs.items():…

ことりん
4年前

Python入門 位置引数のタプル化

# 位置引数のタプル化# def say_something(word, word2, word3):# print(word)# print(word2)# print(word3)def say_something(word, *args): print('word =…

ことりん
4年前

Python入門 位置引数とキーワード引数とデフォルト引数、デフォルト引数で気をつけること

# 位置引数とキーワード引数とデフォルト引数def menu(entree='beef', drink='wine', dessert='ice'): print('entree = ', entree) print('drink = ', drink) print(…

ことりん
4年前

Python入門 関数定義、関数の引数と返り値の宣言

# 関数定義def say_something(): s = 'hi' return sresult = say_something()print(result)def what_is_this(color): if color == 'red': return 'tomato' …

ことりん
4年前

Python入門 辞書をfor文で処理をする

# 辞書をfor文で処理をするd = {'x': 100, 'y': 200}print(d.items())for k, v in d.items(): print(k, ':', v)

ことりん
4年前

Python入門 enumerate関数、zip関数

# enumerate関数# 0 apple# 1 banana# 2 orangefor i, fruit in enumerate(['apple', 'banana', 'orange']): print(i, fruit)# zip関数# Mon apple coffee# Tue banana t…

ことりん
4年前

Python入門 for else文、range関数

# for else文for fruit in ['apple', 'banana', 'orange']: if fruit == 'banana': print('stop eating') break print(fruit)else: print('I ate all!')…

ことりん
4年前

Python入門 for文とbreak文とcontinue文

# for文とbreak文とcontinue文some_list = [1, 2, 3, 4, 5]# i = 0# while i <len(some_list):# print(some_list[i])# i += 1# for i in some_list:# print(i)…

ことりん
4年前

Python入門 input関数

# input関数while True: word = input('Enter:') num = int(word) if num == 100: break print('next')

ことりん
4年前

Python入門 while else文

# while else文count = 0while count < 5: if count == 1: break print(count) count += 1else: print('done')

ことりん
4年前

Python入門 while文とbreak文とcontinue文

#while文とbreak文とcontinue文 #count = 0#while count < 5:# print(count)# count += 1count = 0while True: if count >= 5: # whileから抜ける brea…

ことりん
4年前

Python入門 値が入っていない判定をするテクニック、Noneを判定する場合

# 値が入っていない判定をするテクニック# is_ok = True# False, 0, 0.0, '', [], (), set()is_ok = [1, 2, 3, 4]if is_ok: print('OK!')else: print('NO!')# Noneを判…

ことりん
4年前

Python入門 InとNotの使い所

# InとNotの使い所 y = [1, 2, 3] x = 1 if x in y: print('in') if 100 not in y: print('not in') """ a = 1 b = 2 # pythonでは数字の違いを見るときに no…

ことりん
4年前

Python入門 比較演算子と論理演算子

# 比較演算子と論理演算子a = 1b = 1# a が b と等しいa == b# a が b と異なるa != b# a が b よりも小さいa < b# a が b よりも大きいa > b# a が b 以下であるa <=…

ことりん
4年前

React環境構築 つまづきメモ

Node.jsインストール後、npx create-app d

PS C:\Users\kaopp\React_test> npx create-react-app react-basicnpm ERR! code ENOENTnpm ERR! syscall lstatnpm ERR! path C:\Users\kaopp\AppData\Roaming\npmnpm ERR! errno

もっとみる

Python入門 関数内関数、クロージャー、デコレーター

# 関数内関数def outer(a, b): def plus(c, d): return c + d r1 = plus(a, b) r2 = plus(b, a) print(r1 + r2)outer(1, 2)# クロージャー# def outer(a, b):## def inner():# return a + b## re

もっとみる

Python入門 キーワード引数の辞書化

# キーワード引数の辞書化# def menu(entree='beef', drink='wine'):# print(entree, drink)"""def menu(**kwargs): # print(kwargs) for k, v in kwargs.items(): print(k, v)# menu(entree='beef', drink='coff

もっとみる

Python入門 位置引数のタプル化

# 位置引数のタプル化# def say_something(word, word2, word3):# print(word)# print(word2)# print(word3)def say_something(word, *args): print('word =', word) for args in args: print(args)

もっとみる

Python入門 位置引数とキーワード引数とデフォルト引数、デフォルト引数で気をつけること

# 位置引数とキーワード引数とデフォルト引数def menu(entree='beef', drink='wine', dessert='ice'): print('entree = ', entree) print('drink = ', drink) print('dessert = ', dessert)menu(entree='beef', dessert='ice', dri

もっとみる

Python入門 関数定義、関数の引数と返り値の宣言

# 関数定義def say_something(): s = 'hi' return sresult = say_something()print(result)def what_is_this(color): if color == 'red': return 'tomato' elif color == 'green': return 'green p

もっとみる

Python入門 辞書をfor文で処理をする

# 辞書をfor文で処理をするd = {'x': 100, 'y': 200}print(d.items())for k, v in d.items(): print(k, ':', v)

Python入門 enumerate関数、zip関数

# enumerate関数# 0 apple# 1 banana# 2 orangefor i, fruit in enumerate(['apple', 'banana', 'orange']): print(i, fruit)# zip関数# Mon apple coffee# Tue banana tea# Wed orange beerdays = ['Mon', 'Tue', 'We

もっとみる

Python入門 for else文、range関数

# for else文for fruit in ['apple', 'banana', 'orange']: if fruit == 'banana': print('stop eating') break print(fruit)else: print('I ate all!')# range関数# num_list = [0, 1, 2, 3, 4, 5,

もっとみる

Python入門 for文とbreak文とcontinue文

# for文とbreak文とcontinue文some_list = [1, 2, 3, 4, 5]# i = 0# while i <len(some_list):# print(some_list[i])# i += 1# for i in some_list:# print(i)for word in ['My', 'name', 'is', 'Mike']: i

もっとみる

Python入門 input関数

# input関数while True: word = input('Enter:') num = int(word) if num == 100: break print('next')

Python入門 while else文

# while else文count = 0while count < 5: if count == 1: break print(count) count += 1else: print('done')

Python入門 while文とbreak文とcontinue文

#while文とbreak文とcontinue文 #count = 0#while count < 5:# print(count)# count += 1count = 0while True: if count >= 5: # whileから抜ける break if count == 2: count += 1 # 次の行をスル

もっとみる

Python入門 値が入っていない判定をするテクニック、Noneを判定する場合

# 値が入っていない判定をするテクニック# is_ok = True# False, 0, 0.0, '', [], (), set()is_ok = [1, 2, 3, 4]if is_ok: print('OK!')else: print('NO!')# Noneを判定する場合is_empty = None#print(help(is_empty))# a = None かどうかを判定

もっとみる

Python入門 InとNotの使い所

# InとNotの使い所
y = [1, 2, 3]
x = 1

if x in y:
print('in')

if 100 not in y:
print('not in')
"""
a = 1
b = 2

# pythonでは数字の違いを見るときに not を使うのは好ましくない
if not a == b:
print('Not equal')

if a !=

もっとみる

Python入門 比較演算子と論理演算子

# 比較演算子と論理演算子a = 1b = 1# a が b と等しいa == b# a が b と異なるa != b# a が b よりも小さいa < b# a が b よりも大きいa > b# a が b 以下であるa <= b# a が b 以上であるa >= b# a も b も真であれば真a > 0 and b> 0# a または b が真であれば真a > 0 or b > 0