As a memo for myself, I have summarized the standard input that is likely to be used frequently in paiza's skill check and AtCoder.
input.py
s = input()
input.rb
s = gets.chomp
python
n = int(input())
ruby
n = gets.chomp.to_i
input
1 2 3
python
a,b,c = map(int,input().split())
#Note the int comma input dot split
ruby
a,b,c = gets.chomp.split.map(&:to_i)
input
red blue yellow
python
a,b,c = input().split()
ruby
a,b,c = gets.chomp.split
input
spring summer autumn winter
101 102 103 104
python
x = input().split()
y = list( map(int,input().split()) )
ruby
x = gets.chomp.split
y = gets.chomp.split.map(&:to_i)
output
#x
["spring","summer","autumn","winter"]
#y
[101,102,103,104]
Input: n (number of lines) i1 . . in
python
n = int(input())
I = [ input() for i in range(n) ]
ruby
n = gets.chomp.to_i
array = []
n.times do
i = gets.chomp
array.push(i)
end
Recommended Posts