---
# System prepended metadata

title: lesson18 リスト2 （授業練習用）
tags: [練習用]

---

# lesson18 リスト2 （授業練習用）
###### 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)
```
結果：
![](https://i.imgur.com/u7n9gvs.png)
:::

---
### 1.
:::info
Code:
```python=
languages=["python","c++","java"]
print(languages)
languages.remove("c++")
print(languages)
```
結果：
runfile('C:/Users/user/.spyder-py3/autosave/untitled13.py', wdir='C:/Users/user/.spyder-py3/autosave')
['python', 'c++', 'java']
['python', 'java']




:::

---

### 2.
:::info
Code:
```python=
languages=["python","c++","java","php"]
print(languages)
pop_languages=languages.pop(1)
print(languages)
print("pop_languages=",pop_languages)
pop_languages=languages.pop()
print(languages)
print("pop_languages=",pop_languages)
```
結果：
runfile('C:/Users/user/.spyder-py3/autosave/untitled13.py', wdir='C:/Users/user/.spyder-py3/autosave')
['python', 'c++', 'java', 'php']
['python', 'java', 'php']
pop_languages= c++
['python', 'java']
pop_languages= php




:::

---

### 3.
:::info
Code:
```python=
languages=["python","c++","java","php"]
print(languages)
languages.clear()
print(languages)
```
結果：
['python', 'c++', 'java', 'php']
[]





:::

---

### 4.
:::info
Code:
```python=
strlist=list("python")
print(len(strlist))
print("Len:",len(strlist))
intlist=[0,10,9,2,0,-10,0,-7]
print(intlist)
print("Len:",len(intlist))
```
結果：
runfile('C:/Users/user/.spyder-py3/autosave/untitled14.py', wdir='C:/Users/user/.spyder-py3/autosave')
6
Len: 6
[0, 10, 9, 2, 0, -10, 0, -7]
Len: 8



:::

---

### 5.

:::info
Code:
```python=
val_list=[1,2,3,4,5,-3,4,-6,-79]
print(val_list)
print("max:{}".format(max(val_list)))
print("mini:{}".format(min(val_list)))
```
結果：
runfile('C:/Users/user/.spyder-py3/autosave/untitled16.py', wdir='C:/Users/user/.spyder-py3/autosave')
[1, 2, 3, 4, 5, -3, 4, -6, -79]
max:5
mini:-79


:::

---
### 6.
:::info
Code:
```python=
val_list=[1,2,3,4,5,6,7,8,9]
print(val_list)
print("合計:{}".format(sum(val_list)))
```
結果：
runfile('C:/Users/user/.spyder-py3/autosave/untitled19.py', wdir='C:/Users/user/.spyder-py3/autosave')
[1, 2, 3, 4, 5, 6, 7, 8, 9]
合計:45


:::

---

### 7.
:::info
Code:
```python=

```
結果：


:::

---

### 8.
:::info
Code:
```python=

```
結果：

:::

---

### 9.
:::info
Code:
```python=

```
結果：

:::

---

### 10.

:::info
Code:
```python=

```
結果：

:::

---