We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fc6eb8d commit cb9eb5fCopy full SHA for cb9eb5f
1 file changed
using_list.py
@@ -0,0 +1,24 @@
1
+#!/usr/bin/python3.1
2
+# Filename : using_list.py
3
+
4
+# This is my shopping list
5
+shoplist = ['apple', 'mango', 'carrot', 'banana']
6
7
+print('I have', len(shoplist), 'items to purchase.')
8
+print('These items are:')
9
+for i in range(0, len(shoplist)):
10
+ print('shoplist[', i, '] = ', shoplist[i])
11
12
+print('\nI also have to buy rice.')
13
+shoplist.append('rice')
14
+print('My shopping list is now', shoplist)
15
16
+print('I will sort my list now')
17
+shoplist.sort()
18
+print('Sorted shopping list is ', shoplist)
19
20
+print('The first item I will buy is', shoplist[0])
21
+olditem = shoplist[0]
22
+del(shoplist[0])
23
+print('I bought the', olditem)
24
0 commit comments