Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
recursion task
#3
(Jan-30-2021, 08:10 AM)buran Wrote: please, post the code as one block with proper indentation. If you want to comment specific line - use python comments.
It's difficult to understand what you have and what you want to achieve. e.g. what is i?

not recursion (don't see the need for it or how you would use it anyway), probably something like

import itertools
limits=[(1,9,1,"v"),(50,350,50,"d")]
print(list(itertools.product(range(*limits[0][:-1]), range(*limits[1][:-1]))))
Output:
[(1, 50), (1, 100), (1, 150), (1, 200), (1, 250), (1, 300), (2, 50), (2, 100), (2, 150), (2, 200), (2, 250), (2, 300), (3, 50), (3, 100), (3, 150), (3, 200), (3, 250), (3, 300), (4, 50), (4, 100), (4, 150), (4, 200), (4, 250), (4, 300), (5, 50), (5, 100), (5, 150), (5, 200), (5, 250), (5, 300), (6, 50), (6, 100), (6, 150), (6, 200), (6, 250), (6, 300), (7, 50), (7, 100), (7, 150), (7, 200), (7, 250), (7, 300), (8, 50), (8, 100), (8, 150), (8, 200), (8, 250), (8, 300)]

Thanks for suggestions. I would prefer recursion as to practice. Could you solve without itertools if possible
Reply


Messages In This Thread
recursion task - by scorp08 - Jan-30-2021, 07:22 AM
RE: recursion task - by buran - Jan-30-2021, 08:10 AM
RE: recursion task - by scorp08 - Jan-30-2021, 08:12 AM
RE: recursion task - by buran - Jan-30-2021, 08:14 AM
RE: recursion task - by scorp08 - Jan-30-2021, 08:21 AM
RE: recursion task - by bowlofred - Jan-30-2021, 08:18 AM
RE: recursion task - by jefsummers - Jan-30-2021, 10:30 PM
RE: recursion task - by deanhystad - Jan-31-2021, 05:09 AM
RE: recursion task - by scorp08 - Jan-31-2021, 09:13 AM
RE: recursion task - by subtra3t - Feb-01-2021, 02:56 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  GCF function w recursion and helper function(how do i fix this Recursion Error) hhydration 3 2,667 Oct-05-2020, 07:47 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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