hey guys please check my pytohn program

Mustafa Abbasi lordverminard at gmail.com
Sun Jul 17 14:58:13 UTC 2005


i have modified the code 
now its this.
please see it and check if i have anything the wrong way.
like if i should have used some method but used some other.
i am new to programming so i have no idea what mistakes i make/

> shoplist = []#the list i use
> print shoplist
> c=True
> while c:#the list making loop
> 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()
> f = len(shoplist)
> while len(shoplist) > 0 :
> 
> if len(shoplist) > 0:
> #for f > 0:
> print 'have you bought any items yet \n you may wish to remove them, from 
> the list',
> #print 'what did you buy',
> shoplist.remove(raw_input('what did you buy: '))
> else :
> print 'all items bought',
> 
> 
> #how do i print this list as a text file.
> 
> 
> 
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20050717/1a8e109e/attachment.html>


More information about the ubuntu-users mailing list