hey guys it me again i got stuck in the middle of this program. The program starts with a list declaration of these numbers [1, 2, 4, 5, 6, 7, 8, 9, 10. 2, 53, 12] , i have to make sure the program outputs the following
1 The number of times 2 occurs in the list numbers
2 The position of the first occurrence of 2 in numbers.
3 The position of the next occurrence of 2 in numbers
4 The position of the last item in numbers
5 Sort the items of numbers.
6 The reversal of items in numbers.
7 Appending the value 99 to numbers.
8 Inserting -1 into numbers before position 0
9 Deletes and returns the last item of numbers.
and after each operation, i have to print out the list of numbers to show the
operation has been successful.
here is what i have got stuck on so far.
Sorry i tried to look for the posting guidelines to make sure that i post this programme right but i couldnt if someone can let me where i get it from thanks
1 The number of times 2 occurs in the list numbers
2 The position of the first occurrence of 2 in numbers.
3 The position of the next occurrence of 2 in numbers
4 The position of the last item in numbers
5 Sort the items of numbers.
6 The reversal of items in numbers.
7 Appending the value 99 to numbers.
8 Inserting -1 into numbers before position 0
9 Deletes and returns the last item of numbers.
and after each operation, i have to print out the list of numbers to show the
operation has been successful.
here is what i have got stuck on so far.
Code:
def declaration():
numbers = ['1','2','4','5','6','7','8','9','10.2','53','12'];
for i in range(1):
print'number of times',2,'appears in the list:',numbers.count('2');
Comment