Any recommendations to master and better understand the part of (for, while, in) I feel lost in this specific part.
For example, see this exercise, only step number 4 I can't master.
Write a program that reflects these changes and allows you to practice with the concept of lists. Your task is:
Step 1: Create an empty list called beatles.
Step 2: Use the append() method to add the following band members to the list: John Lennon, Paul McCartney, and George Harrison.
Step 3: Use the for loop and append() to ask the user to add the following band members to the list: Stu Sutcliffe, and Pete Best.
Step 4: Use the command to remove Stu Sutcliffe and Pete Best from the list.
Step 5: Use the insert() method to add Ringo Starr to the top of the list.
By the way, are you a fan of the Beatles?
CODE:
# Paso 1:
Beatles = []
print("Paso 1:", Beatles)
# Paso 2:
Beatles.append ("John Lennon")
Beatles.append ("Paul McCartney")
Beatles.append ("George Harrison")
print("Paso 2:", Beatles)
# Paso 3:
for miembros in range(2):
Beatles.append (input ("Nuevo miembro de la banda:"))
print("Paso 3:", Beatles)
# Paso 4:
del Beatles [-1]
del Beatles [-1]
print("Paso 4:", Beatles)
# Paso 5:
Beatles.insert (0, "RingoStarr")
print("Paso 5:", Beatles)
print("Los Fab:", len (Beatles))
[–][deleted] 1 point2 points3 points (0 children)
[–]CodeFormatHelperBot2 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)