はじめに
pythonのお勉強がてらの自分メモです
動作環境は「paiza」でやってます。
入力値が1行に1つの場合
test.py
#文字列の場合
str = input()
#数値(int)の場合
num = int(input())
入力値が1行に2つ以上の場合
※ここでは便宜上入力値は2つ、区切り文字は半角スペースとする
test.py
#文字列の場合
strA, strB = input().split(' ')
#数値(int)の場合
num1, num2 = map(int, input().split(' '))
入力値が1行に複数ある場合 ⇒ listで取得
※ここでは便宜上区切り文字は半角スペースとする
test.py
#文字列の場合
list = input().split(' ')
#数値(int)の場合1
list = list(map(int, input().split(' ')))
#数値(int)の場合2
list = [int(i) for i in input().split(' ')]