0
can the user's input be saved as an array?if yes then how?
Can i let the user's input be saved as a array of integers or doubles?
5 ответов
+ 6
Hmm... this should work:
tab = []
for i in range(10):
tab.append(int(input('Add an array element: ')))
print(tab)
+ 4
C#:
int[] Integers= Array.ConvertAll(Console.ReadLine().Split(' '),Int32.Parse);
user input must be one line of space separated integers like this:
4 8 15 16 23 42
+ 2
No, not at all :)
Just learning...
+ 1
@kuba the code u wrtoe is for ruby?
+ 1
num = Array.new
loop do
puts "input a number"
num.push(gets.chomp)
end