Putting every digital separately | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Putting every digital separately

What would be the code to place every entered code in a separate placeholder or something. Like 1234 when entered will be placed as 1 2 3 and 4 in separate cells

9th May 2019, 1:19 PM
Adnan Khan
Adnan Khan - avatar
1 Answer
+ 3
to help you we need to know what programming language you expect to do this for you. if you are talking about phyton you can do: sep_inp = list(input(‘Value:’) so input 1234 gives a list: ['1', '2', '3', '4'], this is a list of strings you can iterate with a for loop. if you want to get the list items as int instead of string you can do this: sep_inp = list(map(int, input(‘Value’))) this gives: [1, 2, 3, 4] the same result can also be achived with: sep_inp = [int(x) for x in input(‘Value’)]
9th May 2019, 2:09 PM
Lothar
Lothar - avatar