Search Results

Search found 5 results on 1 pages for 'challarao'.

Page 1/1 | 1 

  • Python-McNuggets problem

    - by challarao
    Hi! I am a student of IIIT.I am new to python.This question is one of the problems in my problem set.Please Help me writing program such as in what I should do it. Show that it is possible to buy exactly 50, 51, 52, 53, 54, and 55 McNuggets, by finding solutions to the Diophantine equation. You can solve this in your head, using paper and pencil, or writing a program. However you chose to solve this problem, list the combinations of 6, 9 and 20 packs of McNuggets you need to buy in order to get each of the exact amounts. Given that it is possible to buy sets of 50, 51, 52, 53, 54 or 55 McNuggets by combinations of 6, 9 and 20 packs, show that it is possible to buy 56, 57,..., 65 McNuggets. In other words, show how, given solutions for 50-55, one can derive solutions for 56-65 6a + 9b + 20c = n

    Read the article

  • python-McNuggets

    - by challarao
    I have created some program for this.But printed a,b,c values are not correct.Please check this weather it is correct or not? n=input("Enter the no.of McNuggets:") a,b,c=0,0,0 count=0 for a in range(n): if 6*a+9*b+20*c==n: count=count+1 break else: for b in range(n): if 6*a+9*b+20*c==n: count=count+1 break else: for c in range(n): if 6*a+9*b+20*c==n: count=count+1 break if count>0: print "It is possible to buy exactly",n,"packs of McNuggetss",a,b,c else: print "It is not possible to buy"

    Read the article

  • Issue using Python to solve the Coin problem [closed]

    - by challarao
    I'm attempting to solve a problem commonly known as the Coin problem, but using McNuggets. McNuggets come in boxes containing either 6, 9, or 20 nuggets. I want to write a python script that uses Diophantine equations to determine if a given number of McNuggets n can be exactly purchased in these groupings. For example: 26 McNuggets -- Possible: 1 6-pack, 0 9-packs, 1 20-pack 27 McNuggets -- Possible: 0 6-packs, 3 9-packs, 0 20-packs 28 McNuggets -- Not possible This is my current attempt at writing the solution in Python, but the output is incorrect and I'm not sure what's wrong. n=input("Enter the no.of McNuggets:") a,b,c=0,0,0 count=0 for a in range(n): if 6*a+9*b+20*c==n: count=count+1 break else: for b in range(n): if 6*a+9*b+20*c==n: count=count+1 break else: for c in range(n): if 6*a+9*b+20*c==n: count=count+1 break if count>0: print "It is possible to buy exactly",n,"packs of McNuggetss",a,b,c else: print "It is not possible to buy"

    Read the article

  • debugging Python program

    - by challarao
    I have created some program for this.But printed a,b,c values are not correct.Please check this whether it is correct or not? n=input("Enter the no.of McNuggets:") a,b,c=0,0,0 count=0 for a in range(n): if 6*a+9*b+20*c==n: count=count+1 break else: for b in range(n): if 6*a+9*b+20*c==n: count=count+1 break else: for c in range(n): if 6*a+9*b+20*c==n: count=count+1 break if count>0: print "It is possible to buy exactly",n,"packs of McNuggetss",a,b,c else: print "It is not possible to buy"

    Read the article

  • python-wordmatching

    - by challarao
    Write two functions, called countSubStringMatch and countSubStringMatchRecursive that take two arguments, a key string and a target string. These functions iteratively and recursively count the number of instances of the key in the target string. You should complete definitions for def countSubStringMatch(target,key): and def countSubStringMatchRecursive (target, key): For the remaining problems, we are going to explore other substring matching ideas. These problems can be solved with either an iterative function or a recursive one. You are welcome to use either approach, though you may find iterative approaches more intuitive in these cases of matching linear structures.

    Read the article

1