Python Forum
How to make a subtraction within a range of numbers?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to make a subtraction within a range of numbers?
#3
(May-08-2017, 08:40 PM)ichabod801 Wrote: I'm not sure what you need as the result. Do you need a list of the subtractions of the pairs of squares, or do you need to start at 1000^2 and subtract all of the other squares from that to get one final number? I'm guessing you want the latter. In that case, you would initialize Answer to 1000 ** 1000. Then loop down from 990, subtracting and storing the new result in Answer. Note that z is not a sequence, it is an integer. So z[z] will give you an error. You just want z ** z.
Thank you for your reply! Yes, I need the later - just the final number. Can you please clarify how can I store the result and go further (to another integer)?

Best regards,
Alberto
Reply


Messages In This Thread
RE: How to make a subtraction within a range of numbers? - by Alberto - May-08-2017, 08:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  forloop to compute sum by alternating from addition to subtraction JulianZ 3 1,927 Apr-02-2022, 09:36 AM
Last Post: DeaD_EyE
  nsimplify, make zero the really small numbers in the matrix quest 5 1,748 Jan-19-2022, 11:41 PM
Last Post: quest
  matplotlib x axis range goes over the set range Pedroski55 5 3,370 Nov-21-2021, 08:40 AM
Last Post: paul18fr
  List index out of range error when attempting to make a basic shift code djwilson0495 4 3,107 Aug-16-2020, 08:56 PM
Last Post: deanhystad
  How to make this function general to create binary numbers? (many nested for loops) dospina 4 4,583 Jun-24-2020, 04:05 AM
Last Post: deanhystad
  Odd numpy error with subtraction DreamingInsanity 5 2,833 Jun-01-2020, 02:49 PM
Last Post: DreamingInsanity
  Return prime numbers from range krzyfigh 2 2,002 Apr-20-2020, 08:08 PM
Last Post: krzyfigh
  Define a range, return all numbers of range that are NOT in csv data KiNeMs 18 7,350 Jan-24-2020, 06:19 AM
Last Post: KiNeMs
  Basic subtraction error rix 4 3,505 Oct-11-2019, 06:43 AM
Last Post: buran
  Print Numbers starting at 1 vertically with separator for output numbers Pleiades 3 3,852 May-09-2019, 12:19 PM
Last Post: Pleiades

Forum Jump:

User Panel Messages

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