DEV Community

yugalakshmi
yugalakshmi

Posted on Edited on

Python Task

Chapathi Story There is one person called Viyan. He is a Software Engineer. He employs a maid for cooking. One day, the maid prepared n number of chapatis and kept in a hot box. Viyan are those chapatis and the count is as follows: * For Morning breakfast, he completed 1/3 number of chapathis in the hot box. * For Lunch, He had 1/3 of what was there in the hot box. * For Dinner, again he took and ate 1/3 number of chapathis present in the box. The next day morning, When the maid checked the number of chapathis remaining, it was 8. What was the number of chapathis, She made - in total?

Flowchart showing a reverse loop starting with 8 chapathis and running 3 times to multiply by 3 and integer-divide by 2, outputting the initial total of 27 chapathis.

chapathis = 8
meals = 1

while meals <= 3:
    chapathis = (chapathis * 3) // 2
    meals = meals + 1

print("Total chapathis:", chapathis)

Enter fullscreen mode Exit fullscreen mode
outout

Total chapathis: 27

Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
payilagam_135383b867ea296 profile image
Payilagam •

What tool is used to create the flowchart.