
Задача. Гаррі купив в магазині «Відьмацькі витівки Візлі» n — карликові пухнастики за ціною 6
шекелів кожен, m — їстівних чорних міток по 11.5 шекелів і одне «Гарантоване виведення прищів за 10 секунд» за 19 шекелів 89 кнатів. Скільки грошей Гаррі заплатив за усю покупку (1 шекель = 100 кнатів)? Числа m та n користувачі вводять з клавіатури, і вони записуються у відповідні змінні. Напиши програму, для Завдання 4 (у вкладенні) Здай 2 посилання

Ответы на вопрос

n = int(input("Введіть кількість карликових пухнастих: "))
m = int(input("Введіть кількість їстівних чорних міток: "))
puhnastyk_cena = 6 # ціна карликових пухнастих
mitka_cena = 11.5 # ціна їстівних чорних міток
vivedennya_cena = 19.89 # ціна "Гарантованого виведення прищів за 10 секунд"
# обчислюємо загальну вартість покупки
total = n * puhnastyk_cena + m * mitka_cena + vivedennya_cena
print("Загальна вартість покупки: {} шекелів {} кнатів".format(int(total), int((total-int(total))*100)))



Problem Analysis
The problem states that Harry bought "Witchy Whimsies Wizly" items from a store. He bought n dwarf fluffies for 6 shekels each, m edible black marks for 11.5 shekels each, and one "Guaranteed Pimple Removal in 10 Seconds" for 19 shekels and 89 knuts. The task is to calculate the total amount of money Harry paid for the entire purchase.Solution
To solve this problem, we need to calculate the total cost of each item and then sum them up.1. Calculate the cost of n dwarf fluffies: - Each dwarf fluffy costs 6 shekels. - Therefore, the total cost of n dwarf fluffies is 6 * n shekels.
2. Calculate the cost of m edible black marks: - Each edible black mark costs 11.5 shekels. - Therefore, the total cost of m edible black marks is 11.5 * m shekels.
3. Calculate the cost of the "Guaranteed Pimple Removal in 10 Seconds": - The cost of the "Guaranteed Pimple Removal in 10 Seconds" is 19 shekels and 89 knuts. - Since 1 shekel is equal to 100 knuts, we need to convert the knuts to shekels. - 19 shekels and 89 knuts is equal to 19 + (89 / 100) shekels.
4. Calculate the total cost of the entire purchase: - The total cost is the sum of the costs of the dwarf fluffies, edible black marks, and the "Guaranteed Pimple Removal in 10 Seconds".
Let's write a program to solve this problem:
```python # Step 1: Get the values of n and m from the user n = int(input("Enter the number of dwarf fluffies: ")) m = int(input("Enter the number of edible black marks: "))
# Step 2: Calculate the cost of each item dwarf_fluffies_cost = 6 * n edible_black_marks_cost = 11.5 * m pimple_removal_cost = 19 + (89 / 100)
# Step 3: Calculate the total cost total_cost = dwarf_fluffies_cost + edible_black_marks_cost + pimple_removal_cost
# Step 4: Print the total cost print("The total cost of the purchase is:", total_cost, "shekels") ```
Please note that the program assumes the user will enter valid integer values for n and m.


Похожие вопросы

Топ вопросов за вчера в категории Информатика









Последние заданные вопросы в категории Информатика
-
Математика
-
Литература
-
Алгебра
-
Русский язык
-
Геометрия
-
Английский язык
-
Химия
-
Физика
-
Биология
-
Другие предметы
-
История
-
Обществознание
-
Окружающий мир
-
География
-
Українська мова
-
Информатика
-
Українська література
-
Қазақ тiлi
-
Экономика
-
Музыка
-
Право
-
Беларуская мова
-
Французский язык
-
Немецкий язык
-
МХК
-
ОБЖ
-
Психология
-
Физкультура и спорт
-
Астрономия
-
Кыргыз тили
-
Оʻzbek tili