atorado en ejercicio
Publicado por Angel (7 intervenciones) el 05/07/2019 04:34:18
Hola todos,
apenas estoy aprendiendo un poco de phyton y en un curso que estoy tomando esoty atorado con este ejercicio:
el set es:
def test() : # do not change this line!
values = [4, 7, 8, 9, -5] # do not change this line!
# write your code here so that it modifies values
# be sure to indent your code!
print(values)
y las instrucciones son:
1. See if the last element of the list is negative. If so, remove it from the list.
2. Then, calculate the average of the first two elements of the list and insert it in between
those two elements.
3. Last, swap the values of the first and last elements of the list.
At the end of the program, print out the list using “print(values)”. In this case, it should print [9,
5.5, 7, 8, 4]
¿alguien que me pudiera dar un pequeña ayuda, no sé como hacer el paso 1 y 2? y por más que he probado con remove and if me marca error.
apenas estoy aprendiendo un poco de phyton y en un curso que estoy tomando esoty atorado con este ejercicio:
el set es:
def test() : # do not change this line!
values = [4, 7, 8, 9, -5] # do not change this line!
# write your code here so that it modifies values
# be sure to indent your code!
print(values)
y las instrucciones son:
1. See if the last element of the list is negative. If so, remove it from the list.
2. Then, calculate the average of the first two elements of the list and insert it in between
those two elements.
3. Last, swap the values of the first and last elements of the list.
At the end of the program, print out the list using “print(values)”. In this case, it should print [9,
5.5, 7, 8, 4]
¿alguien que me pudiera dar un pequeña ayuda, no sé como hacer el paso 1 y 2? y por más que he probado con remove and if me marca error.
Valora esta pregunta


0