Difficulty Level: Medium
6) In a school sports event, all students wearing ODD jersey numbers enter the ground first. After they finish, students with EVEN jersey numbers enter. Display the order.
no = 1
while no <= 10:
print(no, end=" ")
no = no + 2
if no==11:
no=2
OUTPUT:
1 3 5 7 9 2 4 6 8 10
7) A daughter is going on a 5-day vacation. She asks her father to give her ₹5 every day, so she can save the money.
Her father suggests a different plan. Instead of giving her ₹5 daily, he says:
Day 1: ₹1
Day 2: ₹2
Day 3: ₹3
Day 4: ₹4
Day 5: ₹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.
PROGRAM
box=0
day=1
while day <= 5:
box = box + 5
day = day + 1
print(box)
while day<= 10:
box = box + day
day = day+ 1
print(box)
while day<= 5:
box = box + day
day = day+ 1
print(box)
OUTPUT:
25
55
15


Top comments (0)