+ 14
How to provide dynamic range value?
lst=[] for i in range(0,): lst.append(input())
5 Respostas
+ 9
n = int(input())
lst = []
for _ in range(0, n):
lst.append(input())
+ 9
You can put the code in a while loop and add another input which asks the user if he'd like to input another value
Or, alternatively define a 'stop value' which will break the loop if the condition is met
+ 8
Burey
I mean without providing range
Like in C dynamic memory allocation
Memory is increased as values are added.
But here we cannot append after n.
+ 3
Maybe this helps? Built this little guy the other day, your post made me think of it
EDIT: haven't tried the input method with it yet...
https://code.sololearn.com/cqbZK7wU8zLQ/?ref=app
+ 2
Can you please show a c code so that we can figure what kind of behavior you want to have in python?