hey guys please check my pytohn program

Mustafa Abbasi lordverminard at gmail.com
Sun Jul 17 14:20:59 UTC 2005


hi guys.
few days ago i posted which language i should learn an most everyone advised 
python.
i am glad i picked it. its been 2 days and i have alredy learned quite a 
lot.
i have made this little program to create sopping list and was hoping 
somebody could check it out .
just so i have some usefull advise.
ps. please be gentle this is my first program ever. i have been at this for 
only 2 days.
i ma posting the source code in this file since i am not sure how ppl will 
recieve attachment(there is always risk of viruses and 
what not)


 
shoplist = []
> print shoplist
> c=True
> while c:
> a= raw_input('enter items ')
> if a == 'quit':
> c=False
> else: 
> shoplist.append(a)
> 
> print shoplist
> else :
> print 'shoplist done'
> print 'are you done with your shoppiing list\n',
> print 'there are',len(shoplist)#\n'items in your shoplist',
> print 'to remove one enter remove.\n to add more enter add\n to stop enter 
> stop\n to show items enter show\n to count items enter count',
> def remove():
> shoplist.remove(raw_input('remove what: ')),
> def add():
> shoplist.append(raw_input('add what : ')),
> #def stop():
> # break
> c = True
> def show():
> print shoplist
> def count():
> print len(shoplist)
> while c:
> b = raw_input('enter command : ')
> if b =='add':
> add()
> if b =='remove':
> remove()
> #how do i add a way to prevent error when item is not in list.
> #i mean show an error message of my own.
> 
> if b =='stop':
> c = False
> if b =='show':
> show()
> if b =='count':
> count()
> #how do i print this list as a text file.
> 
> 
> 
>  
there are a few question s i have placed.
i cant figure them out. help me with that as well.
thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20050717/74f9ffe7/attachment.html>


More information about the ubuntu-users mailing list