[Tutor] Set values from list as per user input
Dave Angel
davea at davea.name
Wed May 21 15:48:36 CEST 2014
Shweta Kaushik <k-shweta at hcl.com> Wrote in message:
> Hi All,
>
> I am new to python. Please help me.
> I have to create one function which can set values sent by user from a list of values.
>
> For eg:
> I have a list having values between 1 to 100.
> List = ['1', '2', ... '100']
>
> I have to write a function to set values from the list based on user input.
> If user input = 15 in one script, then it should enter this function, take value 15 from list and set this value.
>
> How to do this??
Could out quote the assignment exactly? It'd be a lot easier for
you to solve if you had a clearer problem statement.
Next tell us what version of Python your class is using. input ()
works differently between 2.x and 3.x
Next you should show what's going to happen when this function
works. Is the list always going to contain string versions of the
counting numbers, in order? Or is it going to change while the
program runs? When you "take" the value from the list is the list
now one item shorter? And where is this value to be "put"? What
value is to be returned?
Show us code you've tried and tell us in what way is it wrong.
--
DaveA
More information about the Tutor
mailing list