lease show step by step with comments. Please show it in simplest form. Please don't use any functions Please don't use any def func () Input and Output must match with the Question

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Must show it in Python:
Please show step by step with comments.
Please show it in simplest form.
Please don't use any functions
Please don't use any def func ()
Input and Output must match with the Question
Please go through the Question very carefully.

 

Sample Input 2:
100
10
3
Sample Output 2:
139
Explanation 2:
In this input, the shop will return 3 new chocolates for every 10 empty
packets. So if you have 100 chocolates in the beginning, you can have more
chocolates through the following steps.
Eat 100 chocolates -> 100 empty packs.
100 empty packets -> 30 new chocolates. (3 for each 10)
Eat 30 chocolates -> 30 empty packs.
30 empty packs -> 9 new chocolates.(3 for each 10)
Eat 9 chocolates -> 9 empty packs.
You can't get any more new chocolates with 9 empty packs since 9 is less
than 10.
Now counting all the chocolates you have eaten. You'll get
(100 + 30 + 9) = 139 chocolates in total. So, the output is 139.
Transcribed Image Text:Sample Input 2: 100 10 3 Sample Output 2: 139 Explanation 2: In this input, the shop will return 3 new chocolates for every 10 empty packets. So if you have 100 chocolates in the beginning, you can have more chocolates through the following steps. Eat 100 chocolates -> 100 empty packs. 100 empty packets -> 30 new chocolates. (3 for each 10) Eat 30 chocolates -> 30 empty packs. 30 empty packs -> 9 new chocolates.(3 for each 10) Eat 9 chocolates -> 9 empty packs. You can't get any more new chocolates with 9 empty packs since 9 is less than 10. Now counting all the chocolates you have eaten. You'll get (100 + 30 + 9) = 139 chocolates in total. So, the output is 139.
Question 1:
You will be given three inputs M, N, and P. The M indicates the number of
chocolates you have. And there is a shop where you can get P new chocolates
if you return N empty chocolate packets.
You need to find the total number of chocolates that you can have and print
it.
Sample Input 1:
100
4
1
Sample Output 1:
133
Explanation 1:
In this input, the shop will return 1 new chocolate for every 4 empty
packets. So if you have 100 chocolates in the beginning, you can have more
chocolates through the following steps.
Eat 100 chocolates -> 100 empty packs.
100 empty packs -> 25 new chocolates.
Eat 25 chocolates -> 25 empty packets.
25 empty packets -> 6 new chocolates and 1 empty packet.
Eat 6 chocolates -> (6 + 1 remaining) = 7 empty packs.
7 empty packets -> 1 new chocolate and 3 empty packets.
Eat 1 chocolate -> (1 + 3 remaining) = 4 empty packs.
4 empty packs -> 1 new chocolate.
Eat 1 chocolate -> 1 empty packet.
No new chocolate can be obtained using only 1 packet.
Now counting all the chocolates you have eaten you'll get
(100 + 25 + 6+ 1+ 1) = 133 chocolates in total. So, the output is 133.
Transcribed Image Text:Question 1: You will be given three inputs M, N, and P. The M indicates the number of chocolates you have. And there is a shop where you can get P new chocolates if you return N empty chocolate packets. You need to find the total number of chocolates that you can have and print it. Sample Input 1: 100 4 1 Sample Output 1: 133 Explanation 1: In this input, the shop will return 1 new chocolate for every 4 empty packets. So if you have 100 chocolates in the beginning, you can have more chocolates through the following steps. Eat 100 chocolates -> 100 empty packs. 100 empty packs -> 25 new chocolates. Eat 25 chocolates -> 25 empty packets. 25 empty packets -> 6 new chocolates and 1 empty packet. Eat 6 chocolates -> (6 + 1 remaining) = 7 empty packs. 7 empty packets -> 1 new chocolate and 3 empty packets. Eat 1 chocolate -> (1 + 3 remaining) = 4 empty packs. 4 empty packs -> 1 new chocolate. Eat 1 chocolate -> 1 empty packet. No new chocolate can be obtained using only 1 packet. Now counting all the chocolates you have eaten you'll get (100 + 25 + 6+ 1+ 1) = 133 chocolates in total. So, the output is 133.
Expert Solution
steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education