Python Forum
Can someone please help me write the code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can someone please help me write the code
#6
Be smart with you calculations. Do you need to know the increase per week or do you just need to know the total after 5 weeks?

start = 150
week 1 = start * 1.15
week 2 = week 1 * 1.15
week 3 = week 2 * 1.15
week 4 = week 3 * 1.15
week 5 = week 4 * 1.15

Or

week 5 = 150 * 1.15 * 1.15 * 1.15 * 1.15 * 1.15
week 5 = 150 * 1.15^5

You may want to correct the result to eliminate partial apples.

This can be made to work for the general case when you specify the starting value, the increase rate and the number of increase periods.

The first step in writing code is solving the problem. Once you solve the problem it is fairly simple to translate the solution to code.
Reply


Messages In This Thread
Can someone please help me write the code - by Ram - Feb-07-2021, 11:29 AM
RE: Can someone please help me write the code - by deanhystad - Feb-07-2021, 04:04 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to write a dict code in python ariellea88 4 1,166 Oct-31-2023, 08:45 AM
Last Post: buran
  how to write code demon_calcifer 1 1,674 Nov-16-2021, 04:09 PM
Last Post: Larz60+
  Please help me to write code for this vij 8 3,888 Jun-10-2020, 12:13 PM
Last Post: pyzyx3qwerty
  Write pseudo code for a class assignment Scrimshot 3 3,508 May-07-2019, 05:38 PM
Last Post: Scrimshot
  Write a code to output in alphabetical order AbdelaliPython 1 4,714 Jan-19-2018, 09:03 PM
Last Post: j.crater
  how to write a code for term that can't begin or end with a stopword desul 3 3,882 Mar-18-2017, 03:42 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020