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

Course Content

Python Loops Tutorial

Python Loops Tutorial

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

bookChallenge

Task

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.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 9
toggle bottom row

bookChallenge

Task

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.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 9
toggle bottom row

bookChallenge

Task

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.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Task

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.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Section 1. Chapter 9
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
some-alt