# lesson21: リスト3(授業練習用)
###### tags: `練習用`
:::warning
## スライドにあるコードを練習しよう。自分が書いたコードをコピーし、実行した結果をスクリーンショットしてHackMDに貼り付けてください。
:::
## 例:
:::info
Code:
```python=
r = float(input("Please input value r:"))
r_Round = r * 2 * 3.14
r_Area = r * r * 3.14
print("The round:", r_Round)
print("The area:", r_Area)
```
結果:

:::
---
## 1.
:::info
Code:
```python=
intlist = [-7, 8, 3, -5, -3, 2, 10, 6, -12, -8]
intlist.sort()
print(intlist)
intlist.sort(reverse = True)
print(intlist)
```
結果:
:::
---
## 2.
:::info
Code:
```python=
languages = ["Python", "c++", "Java"]
print(languages)
languages.insert(1, "PHP")
print(languages)
```
結果:
:::
---
## 3.
:::info
Code:
```python=
languages = ["Python", "c++", "Java","PHP"]
print(languages)
copy_languages = languages.copy()
print(copy_languages)
```
結果:
:::
---
## 4.
:::info
Code:
```python=
a = [1, 2, 3]
c = [1, 2, 3]
b = a
c[1] = 7
b[1] = 5
print("a = {}, b = {}, c = {}". format(a, b, c))
```
結果:
a = [1, 5, 3], b = [1, 5, 3], c = [1, 7, 3]
:::
---
## 5.
:::info
Code:
```python=
a = [1, 2, 3]
b = []
for x in a:
b.append(x)
print("a = {}, b = {}". format(a, b))
b[1] = 7
print("a = {}, b = {}". format(a, b))
```
結果:
a = [1, 2, 3], b = [1, 2, 3]
a = [1, 2, 3], b = [1, 7, 3]
:::
---
## 6.
:::info
Code:
```python=
a = [1, 2, 3]
b = a.copy()
print("a = {}, b = {}". format(a, b))
b[1] = 7
print("a = {}, b = {}". format(a, b))
```
結果:
a = [1, 2, 3], b = [1, 2, 3]
a = [1, 2, 3], b = [1, 7, 3]
:::
---
## 7.
:::info
Code:
```python=
languages = ['Python', 'c++', 'Java']
str = input ("input str : ")
if str in languages:
print("{} is in the list". format(str))
else:
print("{} is not in the list". format(str))
```
結果:
:::
---
## 8.
:::info
Code:
```python=
```
結果:
:::
---
## 9.
:::info
Code:
```python=
```
結果:
:::
---
## 10.
:::info
Code:
```python=
```
結果:
:::
---