Accepting a user defined number of inputs in Python. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Accepting a user defined number of inputs in Python.

Good day coders!!! I want to write a code that will contain the following steps. 1. User will define number of inputs in a line, say 7 2. The programme will then prompt the user to start entering their inputs for the given number e.g Input () Input () Input() Input() Input () Input() Input() Thanks, have it in mind that the number of inputs to be prompted will be supplied by the user not the coder. Have tried using a for loop but it's telling me EOFError https://code.sololearn.com/cq88VtvHCJmH/?ref=app https://code.sololearn.com/cq88VtvHCJmH/?ref=app

19th Mar 2020, 6:45 AM
Kareem Basit Adeniyi
Kareem Basit Adeniyi - avatar
4 Answers
+ 2
Download pydroid from playstore because on sololearn, taking inputs is complicated, like u will have to put all ur inputs in the box that appears when u press RUN, 3 (no. of inputs) 2 (first input) 5 (second) 7 (third)
19th Mar 2020, 7:02 AM
maf
maf - avatar
+ 1
n = int(input("Range: ")) for i in range(n): a = int(input("Enter num: "))
19th Mar 2020, 6:54 AM
maf
maf - avatar
+ 1
maf Thanks very much. Really appreciate your reply. But still the same EOFError
19th Mar 2020, 6:56 AM
Kareem Basit Adeniyi
Kareem Basit Adeniyi - avatar
+ 1
Kareem Basit Adeniyi your code is working perfectly, i ran it.
19th Mar 2020, 7:00 AM
maf
maf - avatar