Python Exercise#11

preview_player
Показать описание
Try to solve an exercise based on List and List Slicing.

I will recommend to watch the last 2 session.

Questions:

### List Exercise:

numbers = [10,30,40,56,70,80,90,20,44,67,57,48]

#-----------------------------------------------------------------------------------------

### Q-1.) print(numbers[1:-4:2])

#### Ans:______

#-----------------------------------------------------------------------------------------

### Q-2.) print(numbers[::5-3])

#### Ans:____

#-----------------------------------------------------------------------------------------

### Q-3.) print(numbers[::-2*2])

#### Ans:___

### Q-4.) what will be the output of this statement numbers[3::2] = "C++"

### Ans:____

#-----------------------------------------------------------------------------------------

### Q-5.) numbers = [10,30,40,56,70,80,90,20,44,67,57,48]
### numbers[6:] = "C++"
### print(numbers)

#### Ans: ____

#-----------------------------------------------------------------------------------------

### Q-6.) numbers = [10,30,40,56,70,80,90,20,44,67,57,48]
### numbers[::3] = [3,3,3]

#### Ans:_____

#-----------------------------------------------------------------------------------------

### Q-7.) what is difference between append and extend of the list?

#### Ans:____

#-----------------------------------------------------------------------------------------

### Q-8.) What is difference between remove, pop?

### Ans:____

#-----------------------------------------------------------------------------------------

### Q-9) List is mutable data structure.

a.) True
b.) False

#### Ans:____


#-----------------------------------------------------------------------------------------

### Q-10) We can store integer, float, string or other data structure in the list.

a.) True
b.) False

#### Ans:______
Рекомендации по теме
Комментарии
Автор

1.[30, 56, 80, 20]
2.[10, 40, 70, 90, 44, 57]
3.[48, 20, 56]
4.Error.
5.[10, 30, 40, 56, 70, 80, 'C', '+', '+']
6.Error
7.Append add the element in the list as a list if the 2nd element is a type of list whereas Extend will add the 2nd element of type list as a element only not in the form of list
8.pop will delete an item in the list and returns the deleted element whereas delete will delete the element in the list and does not rerun nothing
9.True
10.True

gnanaprakash
join shbcf.ru