Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge | The for Loop
Python Loops Tutorial
course content

Contenido del Curso

Python Loops Tutorial

Python Loops Tutorial

1. The for Loop
2. The while Loop
3. Nested Loops

Challenge

Tarea

You need to update the provided products_list. If a product's price is greater than $30, apply a 25% discount.

  1. Configure the for loop to iterate through products_list.
  2. Establish the condition: If the price exceeds $30.
  3. Utilize list.append(element) to add an element to the upd_list.
  4. Apply a 25% discount to an element (price) if the price exceeds $30 by multiplying it by 0.75.
  5. Employ round(element, value) to round the price to the nearest cent.
  6. If an element is $30 or lower (the else part), add it to the upd_list without a discount.
  7. Print the updated list.

Tarea

You need to update the provided products_list. If a product's price is greater than $30, apply a 25% discount.

  1. Configure the for loop to iterate through products_list.
  2. Establish the condition: If the price exceeds $30.
  3. Utilize list.append(element) to add an element to the upd_list.
  4. Apply a 25% discount to an element (price) if the price exceeds $30 by multiplying it by 0.75.
  5. Employ round(element, value) to round the price to the nearest cent.
  6. If an element is $30 or lower (the else part), add it to the upd_list without a discount.
  7. Print the updated list.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 1. Capítulo 9
toggle bottom row

Challenge

Tarea

You need to update the provided products_list. If a product's price is greater than $30, apply a 25% discount.

  1. Configure the for loop to iterate through products_list.
  2. Establish the condition: If the price exceeds $30.
  3. Utilize list.append(element) to add an element to the upd_list.
  4. Apply a 25% discount to an element (price) if the price exceeds $30 by multiplying it by 0.75.
  5. Employ round(element, value) to round the price to the nearest cent.
  6. If an element is $30 or lower (the else part), add it to the upd_list without a discount.
  7. Print the updated list.

Tarea

You need to update the provided products_list. If a product's price is greater than $30, apply a 25% discount.

  1. Configure the for loop to iterate through products_list.
  2. Establish the condition: If the price exceeds $30.
  3. Utilize list.append(element) to add an element to the upd_list.
  4. Apply a 25% discount to an element (price) if the price exceeds $30 by multiplying it by 0.75.
  5. Employ round(element, value) to round the price to the nearest cent.
  6. If an element is $30 or lower (the else part), add it to the upd_list without a discount.
  7. Print the updated list.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 1. Capítulo 9
toggle bottom row

Challenge

Tarea

You need to update the provided products_list. If a product's price is greater than $30, apply a 25% discount.

  1. Configure the for loop to iterate through products_list.
  2. Establish the condition: If the price exceeds $30.
  3. Utilize list.append(element) to add an element to the upd_list.
  4. Apply a 25% discount to an element (price) if the price exceeds $30 by multiplying it by 0.75.
  5. Employ round(element, value) to round the price to the nearest cent.
  6. If an element is $30 or lower (the else part), add it to the upd_list without a discount.
  7. Print the updated list.

Tarea

You need to update the provided products_list. If a product's price is greater than $30, apply a 25% discount.

  1. Configure the for loop to iterate through products_list.
  2. Establish the condition: If the price exceeds $30.
  3. Utilize list.append(element) to add an element to the upd_list.
  4. Apply a 25% discount to an element (price) if the price exceeds $30 by multiplying it by 0.75.
  5. Employ round(element, value) to round the price to the nearest cent.
  6. If an element is $30 or lower (the else part), add it to the upd_list without a discount.
  7. Print the updated list.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Tarea

You need to update the provided products_list. If a product's price is greater than $30, apply a 25% discount.

  1. Configure the for loop to iterate through products_list.
  2. Establish the condition: If the price exceeds $30.
  3. Utilize list.append(element) to add an element to the upd_list.
  4. Apply a 25% discount to an element (price) if the price exceeds $30 by multiplying it by 0.75.
  5. Employ round(element, value) to round the price to the nearest cent.
  6. If an element is $30 or lower (the else part), add it to the upd_list without a discount.
  7. Print the updated list.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 1. Capítulo 9
Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
We're sorry to hear that something went wrong. What happened?
some-alt