Created
February 22, 2017 01:31
-
-
Save chuck0523/afc68ac34d7db66f39071f71e05eb4aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1行の入力データを分割 | |
data = input().split() # "1 2 3"と入力 | |
print(data) #['1', '2', '3'] | |
print(data[0]) # 1 | |
print(type(data[0])) # str | |
# 入力データの数値化 | |
nums = list(map(int, input().split())) # "1 2 3"と入力 | |
## Python3では、listを使う必要がある。mapはリストを返す仕様ではなくなったため。 | |
print(nums) # [1, 2, 3] | |
print(nums[0]) # 1 | |
print(type(nums[0])) # int | |
# 浮動小数点数 | |
floats = list(map(float, input().split())) | |
# リストではなく、別個の変数に代入する場合。 | |
a, b, c = input().split() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment