Python -2

```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']

cnt = 1
for member in boss:
    print(cnt, member)
    cnt = cnt + 1
    
cnt = len(boss)
for member in boss:
    print(cnt, member)
    cnt = cnt - 1

>>>

1 john
2 lisa
3 bob
4 jack
5 takashi
6 nori
7 mari
8 sachi
8 john
7 lisa
6 bob
5 jack
4 takashi
3 nori
2 mari
1 sachi
```
```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']
even=[]
odd=[]

cnt = 1
for member in team:
    if(cnt%2 == 0):
        even.append(member)
    else:
        odd.append(member)
    cnt = cnt + 1
print(even)
print(odd)

>>>

['nao', 'lisa', 'ryo', 'jack', 'linda', 'takashi', 'yuki', 'take', 'nori', 'sachi']
['sato', 'john', 'kaoru', 'bob', 'mary', 'yosuke', 'saori', 'tomo', 'yusuke', 'mari']
```
```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']
even=[]
odd=[]

    cnt = 1
    for member in team:
        if(cnt%2 == 0):
            name = member + '-even'
            even.append(name)
        else:
            name = member + '-odd'
            odd.append(name)
        cnt = cnt + 1
    print(even)
    print(odd)

>>>

['nao-even', 'lisa-even', 'ryo-even', 'jack-even', 'linda-even', 'takashi-even', 'yuki-even', 'take-even', 'nori-even', 'sachi-even']
['sato-odd', 'john-odd', 'kaoru-odd', 'bob-odd', 'mary-odd', 'yosuke-odd', 'saori-odd', 'tomo-odd', 'yusuke-odd', 'mari-odd']

```
```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']

for member in range(5):
    print(boss[member])
    
cnt = 0
while(cnt<5):
    print(boss[cnt])
    cnt = cnt + 1

>>>

john
lisa
bob
jack
takashi
john
lisa
bob
jack
takashi
```
```python
def show_boss(n):
    boss=['john','lisa','bob','jack','takashi','nori','mari','sachi']
    print(n,'人')
    for n in range(n):
        print(boss[n])
        
def say():
    print('hello')       
        
def say_test(word):
    print(word)
    
def say_test1(word):
    print('------')
    print(word)
    print('------')
    
    
show_boss(5)
show_boss(4)
show_boss(1)
say()
say_test('hello')

say_test('------')
say_test('start')
say_test('------')
show_boss(5)
say_test('------')
say_test('end')
say_test('------')

say_test1('start')
show_boss(5)
say_test1('end')

>>>

5 人
john
lisa
bob
jack
takashi
4 人
john
lisa
bob
jack
1 人
john
hello
hello
------
start
------

5 人
john
lisa
bob
jack
takashi
------
end
------
------
start
------

5 人
john
lisa
bob
jack
takashi
------
end
------
```

```
 create view grouplist2(name, age, address, flag)
	as
select name, age, address,
	case
		when (address in ('tokyo', 'kyoto')) and (age between 10 and 19) then 1
		when (address in ('tokyo', 'kyoto')) and (age between 20 and 29) then 2
		when (address in ('tokyo')) and (age between 30 and 39) then 3
		when (address in ('kyoto')) and (age between 30 and 39) then 3
		when (address in ('tokyo', 'kyoto')) and (age between 40 and 49) then 4
		else null
	end as flag
from userlist;
```

```python
def getLenList(mlist):
    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']
    
    return(len(mlist))
    
print(getLenList(boss))
print(getLenList(team)) 

cnt=getLenList(boss)
for n in range(cnt):
    print(boss[n])

>>>

8
20
john
lisa
bob
jack
takashi
nori
mari
sachi

```

```python

class showList:
    def show_list(self, mlist):
        for member in mlist:
            print(member)
            
    def getLenList(self, mlist):
        return len(mlist)
    
    def say(self):
        print('hello')
    
boss=['john','lisa','bob','jack','takashi','nori','mari','sachi']
s=showList()
s.show_list(boss)
s.say()

>>>

john
lisa
bob
jack
takashi
nori
mari
sachi
hello
```

```python
class Hero:
    def say(self, name):
        print('I am hero')
        print('My name is', name)
        
        
h=Hero()
h.say('sato')

>>>

I am hero
My name is sato
```

```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']
staff=[]

cnt = 0
for member in range(len(team)):
#    print(team[cnt])
    cnt = cnt + 1

for member in team:
    if member in boss:
        staff.append(member)
#print(staff)
staff.append('leader')
#print(staff)

def showstaff(mlist):
    for member in mlist:
        print(member)

showstaff(staff)

>>>

john
lisa
bob
jack
takashi
nori
mari
sachi
leader
```

```python
from pprint import pprint
score={}
score['jp']=79
score['math']=85
score['rika']=88
score['shakai']=70
pprint(score)

keys=score.keys()
print(keys)
for key in keys:
    print(score[key])

>>>

{'jp': 79, 'math': 85, 'rika': 88, 'shakai': 70}
dict_keys(['jp', 'math', 'rika', 'shakai'])
79
85
88
70
```

```python
score={}
score['jp']=88
score['math']=91
score['rika']=72
score['shakai']=81

keys=score.keys()
for key in keys:
    print(key, ':', score[key])

cnt = 0
for key in keys:
    cnt = cnt + score[key] 
    
print(cnt)

print(cnt/len(keys))

>>>

jp : 88
math : 91
rika : 72
shakai : 81
332
83.0
```

```python

class StudentScore:
    def show_score(self, score):
        keys=score.keys()
        for key in keys:
            print(key, score[key])
            
    def show_avg(self, score):
        keys=score.keys()
        sum = 0
        for key in keys:
            sum = sum + score[key]
        print(sum/len(keys))
            
score={}
score['jp']=79
score['math']=85
score['rika']=88
score['shakai']=70

ss=StudentScore()
ss.show_score(score)
ss.show_avg(score)

>>>

jp 79
math 85
rika 88
shakai 70
80.5
```
```python

class Hero:
    def say(self, word):
        print(word)
    
    def sing(self, n):
        cnt = 1
        while(cnt <= n):
            cnt = cnt + 1
            print('sing')
    
    def show(self, name):
        for member in name:
            print(member)
    
hero=Hero()
hero.say('hello')
hero.sing(3)
#hero.sing2(2)
hero.show(boss)

>>>

hello
sing
sing
sing
john
lisa
bob
jack
takashi
nori
mari
sachi
```