Menu

Daily Savings Challenge: Learn Python Loops Through a Real-Life Problem
📰

Daily Savings Challenge: Learn Python Loops Through a Real-Life Problem

DEV Community: beginners·Sowntharya·5 days ago
#bWjuGWf7
Reading 0:00
15s threshold

Problem 1:

A daughter is going on a 5-day vacation. She asks her father to give her Rs. 5 every day, so she can save the money.

Her father suggests a different plan. Instead of giving her Rs. 5 daily, he says:

Day 1: Rs. 1

Day 2: Rs. 2

Day 3: Rs. 3

Day 4: Rs. 4

Day 5: Rs. 5

The daughter agrees to her father's proposal.

Write a program to calculate:

A) The total amount the daughter would receive under her original plan.

B) The total amount she would receive under her father's plan.

C) Display both totals.

Redo the same activity for 10 days leave, instead of 5 days.

box = 0

day = 1

box = box + 5

day = 2

box = box + 5

day = 3

box = box + 5

day = 4

box = box + 5

day = 5

box = box + 5

print(box)

box = 0

day = 1

box = box + 5

day = day + 1

box = box + 5

day = day + 1

box = box + 5

day = day + 1

box = box + 5

day = day + 1

box = box + 5

print(box)

box = 0 day = 1 while day <= 5 : box = box + 5 day = day + 1

print ( box )

Enter fullscreen mode

Exit fullscreen mode

box =…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.