Hi, how to int(input()) but only take the first 10 integers from the input to input-variable? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Hi, how to int(input()) but only take the first 10 integers from the input to input-variable?

foo = int(input()) python

27th Aug 2017, 6:08 PM
Da Riebi
Da Riebi - avatar
4 Answers
+ 1
l = [int(input()) for i in range(10)]
27th Aug 2017, 6:30 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
THX. the variable will get the Entry as a list, right?
27th Aug 2017, 6:35 PM
Da Riebi
Da Riebi - avatar
+ 1
Yes, as this is how I decided to, but it can be changed ^^
27th Aug 2017, 6:40 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
:-)
27th Aug 2017, 6:41 PM
Da Riebi
Da Riebi - avatar