A newbie that needs some HELP
Philip Swartzleonard
starx at pacbell.net
Mon Nov 26 06:32:31 EST 2001
Don Arnold || Sun 25 Nov 2001 05:49:22p:
>
>On 25-Nov-2001, "The News" <lbaker at hot.rr.com> wrote:
>
>
>> Now on to the problem.
>> I'm working on lists. Trying to figure them out. So I decide to
>> write this little algorithim for user inserted lists. My proto goes
>> as follows:
>>
>> monty = []
>> number = input("How many Monty's are there?")
>> for x in range(1,number):
>> mln = input("Name a Monty?")
>> monty.append(aln)
>> print monty
>>
>> It gets through it but prints out some wierd stuff along with each
>> listed monty. Can someone tell me what I'm doing wrong? Also, when I
>> try to get it to repeat x at the end of "Name a Monty #", x it gives
>> me an error. How could I get around that?
>>
>
>Use 'raw_input()' instead of 'input()'.
No one else seems to have noticed, but i think you want
'int( raw_input() )' as the total expression, as you want to use the input
to create a range of numbers while raw_input() returns a string... int()
parses this for you. :)
--
Philip Sw "Starweaver" [rasx] :: www.rubydragon.com - a few thousand lines
[*BROKEN] of PHP, HTML, and CSS; but still useless*
:)
More information about the Python-list
mailing list