Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new repo #5

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
35 changes: 35 additions & 0 deletions source/2021-01-25-first-post.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
title: 6歳にウケるPython
date: 2021-01-25
tags: ["Python", "初投稿"]

Gitpressでは、Code-knackという機能で、コードの実行ボタン付きのシンタックスハイライトが使えます
Code Pen に似ていますね

とりあえずハロワから試してみましょう

```python

print('Hello Python!')

```

6歳にウケるPythonのコードを紹介します

```PYTHON

r = input('すうじをいれてね(0~2):')

print(r)

if (r == '0') or (r == '1') or (r == '2'):
print ('いいすうじですね!')
else:
print ('すうじは、0,1,2のどれかにしてね')

```

お子さんの好きな数字を聞いて、書き換えてあげましょう


参考記事: [【Web】Gitpressが凄い!いろんなコードを動かせる記事がかけるんだ Code-knakが凄いのか!?【Git】]
(https://tom2rd.sakura.ne.jp/wp/2019/06/20/post-9425/)
73 changes: 73 additions & 0 deletions source/Pythonによる論理演算のシンプルな実装.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
誰が要るのか知らないけれど
やってみるとちょっとおもしろい
論理演算のシンプルな実装です



論理和(AND)
```python
def AND(x, y):
return bool(x and y)

print(AND(0,0))
print(AND(0,1))
print(AND(1,0))
print(AND(1,1))
```

否定論理和(NAND)
```python
def NAND(x, y):
return bool(not x or not y)

print(NAND(0,0))
print(NAND(0,1))
print(NAND(1,0))
print(NAND(1,1))

#演算子がand →orに変化
```

論理和(OR)
```python
def OR(x, y):
return bool(x or y)

print(OR(0,0))
print(OR(0,1))
print(OR(1,0))
print(OR(1,1))
```

否定論理和(NOR)
```python
def NOR(x, y):
return bool(not x and not y)

print(NOR(0,0))
print(NOR(0,1))
print(NOR(1,0))
print(NOR(1,1))

#演算子がor →andに変化
```

排他的論理和(XOR)
```python
def XOR(x, y):
return bool((x and not y) or (not x and y))

print(XOR(0,0))
print(XOR(0,1))
print(XOR(1,0))
print(XOR(1,1))
```

否定(NOT)
```python
def NOT(x):
return bool(not x)

print(NOT(0))
print(NOT(1))
```