Зміст курсу
Introduction to Python for Data Analysis
Introduction to Python for Data Analysis
For Loop
We use loops if we want to repeat any action n-times.
Look at the example!
# Decreasing prices by 1 prices = [3, 5, 6, 2, 7, 8] for i in prices: print(i, end = ' ')
end = ' '
means that the result will be written in one row (not column).
Look at the table to understand how to minimize the writing of mathematical operators!
Formula | How to minimize |
a = a + 1 | a += 1 |
a = a - 1 | a -= 1 |
a = a * 2 | a *= 2 |
a = a / 2 | a /= 2 |
Завдання
Update subscription prices according to discounts.
- Set the for loop to work with the
prices
using thei
iterator. - Set the condition if the element of the list is greater than
30
. - Set the
25%
discount if the price is greater than30
. - Decrease the
i
by3
. - Print the
prices
.
Дякуємо за ваш відгук!
For Loop
We use loops if we want to repeat any action n-times.
Look at the example!
# Decreasing prices by 1 prices = [3, 5, 6, 2, 7, 8] for i in prices: print(i, end = ' ')
end = ' '
means that the result will be written in one row (not column).
Look at the table to understand how to minimize the writing of mathematical operators!
Formula | How to minimize |
a = a + 1 | a += 1 |
a = a - 1 | a -= 1 |
a = a * 2 | a *= 2 |
a = a / 2 | a /= 2 |
Завдання
Update subscription prices according to discounts.
- Set the for loop to work with the
prices
using thei
iterator. - Set the condition if the element of the list is greater than
30
. - Set the
25%
discount if the price is greater than30
. - Decrease the
i
by3
. - Print the
prices
.
Дякуємо за ваш відгук!
For Loop
We use loops if we want to repeat any action n-times.
Look at the example!
# Decreasing prices by 1 prices = [3, 5, 6, 2, 7, 8] for i in prices: print(i, end = ' ')
end = ' '
means that the result will be written in one row (not column).
Look at the table to understand how to minimize the writing of mathematical operators!
Formula | How to minimize |
a = a + 1 | a += 1 |
a = a - 1 | a -= 1 |
a = a * 2 | a *= 2 |
a = a / 2 | a /= 2 |
Завдання
Update subscription prices according to discounts.
- Set the for loop to work with the
prices
using thei
iterator. - Set the condition if the element of the list is greater than
30
. - Set the
25%
discount if the price is greater than30
. - Decrease the
i
by3
. - Print the
prices
.
Дякуємо за ваш відгук!
We use loops if we want to repeat any action n-times.
Look at the example!
# Decreasing prices by 1 prices = [3, 5, 6, 2, 7, 8] for i in prices: print(i, end = ' ')
end = ' '
means that the result will be written in one row (not column).
Look at the table to understand how to minimize the writing of mathematical operators!
Formula | How to minimize |
a = a + 1 | a += 1 |
a = a - 1 | a -= 1 |
a = a * 2 | a *= 2 |
a = a / 2 | a /= 2 |
Завдання
Update subscription prices according to discounts.
- Set the for loop to work with the
prices
using thei
iterator. - Set the condition if the element of the list is greater than
30
. - Set the
25%
discount if the price is greater than30
. - Decrease the
i
by3
. - Print the
prices
.