90.6k views
5 votes
PLEASE HELP ME WITH THIS PYTHON CODE::::: THANKS!!!

Lists are an example of a data abstraction.


A data abstraction can often contain different types of elements. It also provides a separation between the abstract properties of a data type (integer, boolean, string) and the concrete details of its representation. Basically, it doesn’t matter that the type are different!


Create an empty list. Append the integer 3, a string of "hello" and a boolean of False into the list. Print out each index individually. Now, remove the number 3 and False from the list.


Finally, print out the list again.

User Sathwick
by
4.7k points

1 Answer

2 votes

Answer:

Step-by-step explanation:

The following Python code does exactly as requested. Once the list is created and the elements are added to it, it uses a for loop to print out each element individually. Then once the loop is over it removes the 3 and False elements from the list and creates another for loop to print the remaining element(s) individually again.

my_list = []

my_list.append(3)

my_list.append("hello")

my_list.append(False)

for x in my_list:

print(x)

my_list.remove(3)

my_list.remove(False)

for x in my_list:

print(x)

User Bibo
by
4.5k points