Answer to Question #282275 in Python for Evans Mulenga

Question #282275

Provide your own examples of the following using Python lists. Create your own examples. Do not copy them from another source.



Nested lists


The “*” operator


List slices


The “+=” operator


A list filter


A list operation that is legal but does the "wrong" thing, not what the programmer expects


Provide the Python code and output for your program and all your examples.

1
Expert's answer
2021-12-24T01:20:33-0500
Nested_lists = ['only first "floor"', ['second floor',['Third floor', 'here living cats'],

['Underground', 'Dinasaurs', ['I dont know where we are']]]]

print('Nested lists: ', Nested_lists)




print('')




my_property = ['house', 'car', 'money', 'computer']

print('Now I have ')

print(my_property)

print(' but then I make my startup it will be ')

print(my_property * 5)




print('')




print('But if my startup fold up I will have only')

print(my_property[1:3])

print('')




me = ['car', 'flat']

wife = ['nothing']

print('When me and my wife married, we combined our property')

me += wife

print(me)

print('')

cars = ['BMW', 'Mercedes', 'Skoda']

print(cars)

print('Here something need to remove')

cars[0] = cars[2]

cars[1] = cars[2]

print('Alright')

print(cars)

print('')




# For me strange was that

car = 'skoda'

my_car = 'skoda'

print(car is my_car)




cars = ['bmw', 'mercedes', 'skoda']

my_cars = ['bmw', 'mercedes', 'skoda']

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS