Python 基本コード練習

```python
1129+2344
3473
```


```python
(40+50)*3-50
220
```

```python
2**3
8
```

```python
tax = 0.8
price = 120
suzuki_telephone = '090-1234 -5678'

price * tax
9.6
```


```python
import keyword
key.kwlist
```

```python
34 > 22
True
```

```python
'thunder' + 'bolt'
'thunderbolt'
```

```python
'hunter' * 2
'hunterhunter'
```


```python
word = 'maintenane'
word.count('n')

3
```

```python
Agroup = ['Kazu', 'Gosu']
Agroup.append('dai')
Agroup

['Kazu', 'Gosu', 'dai']
```

```python
Agroup = ['Kazu', 'Gosu', 'dai']
Agroup.remove('dai')
Agroup

['Kazu', 'Gosu']
```

```python
Agroup = ['Dai', 'Gosu', 'Kazu']
Agroup.sort()
Agroup

['Dai', 'Gosu', 'Kazu']

```

```python
activites = {'Monday':'basuke', 'Tuesday':'zitensya', 'Wednesday':'keion'}

activites['Tuesday']

'zitensya'
```

```python
activites = {'Monday':'basuke', 'Tuesday':'zitensya', 'Wednesday':'keion'}

activites.keys()

dict_keys(['Monday', 'Tuesday', 'Wednesday'])
```

```python
activites = {'Monday':'basuke', 'Tuesday':'zitensya', 'Wednesday':'keion'}

activites.values()

dict_values(['basuke', 'zitensya', 'keion'])
```

```python
flavor_list = ['mint', 'choco', 'strawberry', 'banana']
flavor_list[0] = 'ramurezon'
print(flavor_list)

['ramurezon', 'choco', 'strawberry', 'banana']
```

```python
diary = {}
key = ('kamata', '08-01')
diary[key] = '70kg'
print(diary)

{('kamata', '08-01'): '70kg'}
```

```python
flavor = {'apple', 'banana', 'soda'}
candy = set(flavor)
candy

{'apple', 'banana', 'soda'}
```

```python
flavor = {'apple', 'banana', 'soda'}
candy = set(flavor)

candy.update(['grape'])
candy

{'apple', 'banana', 'grape', 'soda'}
```

```python
flavor = {'apple', 'banana', 'soda'}
flavorb = {'apple', 'banana', 'choco'}

flavor - flavorb

{'soda'}
```

```python
flavor = {'apple', 'banana', 'soda'}
flavorb = {'apple', 'banana', 'choco'}

flavor & flavorb

{'apple', 'banana'}
```

```python
age = 29
if (60 <= age):
    print('sell ticket')
    
elif (18 <=age):
    print('sell sell ')
    
else:
    print('not sell')

sell sell 
```

```python
pointcard = True
count = 5
if ((pointcard == True) and (count == 5)):
    print('arigato')

arigato
```

```python
for count in range(3):
    print('chris')
    print(count)

chris
0
chris
1
chris
2
```

```python
li = ['do','ro','ao','ho']

for momo in li:
    print('now ... ' + momo)

now ... do
now ... ro
now ... ao
now ... ho
```


```python
co = 0
while(co < 5):
    print(co)
    co = co+1

0
1
2
3
4
```


```python
li = ['do','ro','ao','ho']

for momo in li:
    print('now ... ' + momo)
    print('hetta')
    print('gohan')
    
    continue
    print('gogo')

now ... do
hetta
gohan
now ... ro
hetta
gohan
now ... ao
hetta
gohan
now ... ho
hetta
gohan
```

```python
dic = {}

dic['one'] = 'tennis'
dic['two'] = 'music'
dic['three'] = 'soccer'

print(dic)

{'one': 'tennis', 'two': 'music', 'three': 'soccer'}
```

```python
team=['sato','nao','john','lisa','kaoru','ryo','bob','jack','mary','linda','yosuke','takashi','saori', 'yuki','tomo', 'take','yusuke','nori','mari','sachi']

boss=['john','lisa','bob','jack','takashi','nori','mari','sachi']

dic = {}

dic['one'] = 'tennis'
dic['two'] = 'music'
dic['three'] = 'soccer'

dic['listTeam'] = team



print(dic['listTeam'][2])


john
```

```python
team=['sato','nao','john','lisa','kaoru','ryo','bob','jack','mary','linda','yosuke','takashi','saori', 'yuki','tomo', 'take','yusuke','nori','mari','sachi']

boss=['john','lisa','bob','jack','takashi','nori','mari','sachi']

dic = {}

dic['one'] = 'tennis'
dic['two'] = 'music'
dic['three'] = 'soccer'

dic['listTeam'] = team
keys = dic.keys()


print(keys)

dict_keys(['one', 'two', 'three', 'listTeam'])
```

```python
team=['sato','nao','john','lisa','kaoru','ryo','bob','jack','mary','linda','yosuke','takashi','saori', 'yuki','tomo', 'take','yusuke','nori','mari','sachi']

boss=['john','lisa','bob','jack','takashi','nori','mari','sachi']

dic = {}

dic['one'] = 'tennis'
dic['two'] = 'music'
dic['three'] = 'soccer'

dic['listTeam'] = team
keys = dic.keys()

for key in keys:
    print(dic[key])

tennis
music
soccer
['sato', 'nao', 'john', 'lisa', 'kaoru', 'ryo', 'bob', 'jack', 'mary', 'linda', 'yosuke', 'takashi', 'saori', 'yuki', 'tomo', 'take', 'yusuke', 'nori', 'mari', 'sachi']
```

```python
def show():
    print('hello world')
    
def say(word):
    print(word)
    
def answer(word, n):
    for cnt in range(n):
        print(word)

show()
say('how are you?')
answer('im fine',4)

hello world
how are you?
im fine
im fine
im fine
im fine
```