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

Conteúdo do Curso

Python Loops Tutorial

Python Loops Tutorial

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

Challenge

Tarefa

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.

Tarefa

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.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo

Tudo estava claro?

Seção 1. Capítulo 9
toggle bottom row

Challenge

Tarefa

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.

Tarefa

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.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo

Tudo estava claro?

Seção 1. Capítulo 9
toggle bottom row

Challenge

Tarefa

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.

Tarefa

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.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo

Tudo estava claro?

Tarefa

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.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Seção 1. Capítulo 9
Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
We're sorry to hear that something went wrong. What happened?
some-alt