Hi, thank you in advance for taking the time to read this query and help me.
I am very stuck with this problem!!!
I am trying to produce a query in Python3. Which will show all the possible calculations to a specific value using a restricted range of numbers.
So if the number i input ( N= 4 )
if my options are 1,3,4 the result would show:
1+1+1+1
3+1
1+3
4
Currently i have been able to find code to tell me the number of possibilities but not show me what they are; my code so far is:
I am very stuck with this problem!!!
I am trying to produce a query in Python3. Which will show all the possible calculations to a specific value using a restricted range of numbers.
So if the number i input ( N= 4 )
if my options are 1,3,4 the result would show:
1+1+1+1
3+1
1+3
4
Currently i have been able to find code to tell me the number of possibilities but not show me what they are; my code so far is:
def Sums134(n): DP = [0 for i in range(0, n + 1)] DP[0] = DP[1] = DP[2] = 1 DP[3] = 2 for i in range(4, n + 1): DP[i] = DP[i - 1] + DP[i - 3] + DP[i - 4] return DP[n] n = 10 print (Sums134(n))
Larz60+ write Nov-01-2020, 11:50 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
I fixed this for you this time. Please use bbcode tags on future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
I fixed this for you this time. Please use bbcode tags on future posts.