[Tutor] Set values from list as per user input

Alan Gauld alan.gauld at btinternet.com
Wed May 21 15:44:58 CEST 2014


On 21/05/14 13:39, Shweta Kaushik wrote:
> 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.

Sorry I didn't understand the last line at all.

Which function should it enter?
Where should the value be set?
When you say "take 15 from list" what happens to the
original list? Does it lose 15, so that 15 can only be used once?
Or does the original list remain fully populated?

Can you give a more detailed explanation?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list