teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

5

修正

2020/06/14 07:41

投稿

ForestSeo
ForestSeo

スコア2724

answer CHANGED
@@ -1,6 +1,6 @@
1
1
  [コンピューターが2進数](https://type.jp/et/feature/11485)だからじゃないですか?
2
2
  ***
3
- `decimal`を使う
3
+ `decimal`(10進数扱う)を使う
4
4
  ```Python
5
5
  from decimal import Decimal
6
6
 

4

修正

2020/06/14 07:41

投稿

ForestSeo
ForestSeo

スコア2724

answer CHANGED
@@ -1,4 +1,5 @@
1
1
  [コンピューターが2進数](https://type.jp/et/feature/11485)だからじゃないですか?
2
+ ***
2
3
  `decimal`を使う
3
4
  ```Python
4
5
  from decimal import Decimal
@@ -12,4 +13,16 @@
12
13
  # ・・・
13
14
  # 1.5
14
15
  # 1.6
16
+ ```***
17
+ 整数で
18
+ ```Python
19
+ n = 6
20
+ while n <= 16:
21
+ print(n/10)
22
+ n += 1
23
+ # 0.6
24
+ # 0.7
25
+ # ・・・
26
+ # 1.5
27
+ # 1.6
15
28
  ```

3

修正

2020/06/14 07:39

投稿

ForestSeo
ForestSeo

スコア2724

answer CHANGED
@@ -1,1 +1,15 @@
1
- [コンピューターが2進数](https://type.jp/et/feature/11485)だからじゃないですか?
1
+ [コンピューターが2進数](https://type.jp/et/feature/11485)だからじゃないですか?
2
+ `decimal`を使う
3
+ ```Python
4
+ from decimal import Decimal
5
+
6
+ n = Decimal("0.6")
7
+ while n <= 1.6:
8
+ print(n)
9
+ n += Decimal("0.1")
10
+ # 0.6
11
+ # 0.7
12
+ # ・・・
13
+ # 1.5
14
+ # 1.6
15
+ ```

2

修正

2020/06/14 07:37

投稿

ForestSeo
ForestSeo

スコア2724

answer CHANGED
@@ -1,1 +1,1 @@
1
- [コンピューターが進数](https://type.jp/et/feature/11485)だからじゃないですか?
1
+ [コンピューターが2進数](https://type.jp/et/feature/11485)だからじゃないですか?

1

修正

2020/06/14 07:33

投稿

ForestSeo
ForestSeo

スコア2724

answer CHANGED
@@ -1,16 +1,1 @@
1
- [コンピューターが進数](https://type.jp/et/feature/11485)だからじゃないですか?
1
+ [コンピューターが進数](https://type.jp/et/feature/11485)だからじゃないですか?
2
- ```Python
3
- for n in range(6, 17):
4
- print(n/10)
5
- # 0.6
6
- # 0.7
7
- # 0.8
8
- # 0.9
9
- # 1.0
10
- # 1.1
11
- # 1.2
12
- # 1.3
13
- # 1.4
14
- # 1.5
15
- # 1.6
16
- ```こうすればいけますが。