fork download
  1. shoplist=['mango ','carrot ','apple ','banana ']
  2. print ('i have to buy:',end='')
  3. for item in shoplist:
  4. print(item,end='')
  5. print('\ni have to also bue rice')
  6. shoplist.append('rice')
  7. print('my shop list is now',shoplist)
  8. shoplist.sort()
  9. print('sorted shp list is',shoplist)
  10. print('the first is',shoplist[0])
  11. olditem=shoplist[0]
  12. print ('i bought',olditem)
  13. del shoplist[0]
  14. print ('i new shop list is',shoplist)
Success #stdin #stdout 0.05s 9568KB
stdin
Standard input is empty
stdout
i have to buy:mango carrot apple banana 
i have to also bue rice
my shop list is now ['mango ', 'carrot ', 'apple ', 'banana ', 'rice']
sorted shp list is ['apple ', 'banana ', 'carrot ', 'mango ', 'rice']
the first is apple 
i bought apple 
i new shop list is ['banana ', 'carrot ', 'mango ', 'rice']