The program I'm trying to create is one where it asks for an amount of money, lets say 10 bucks. It will take the input and then randomly come up with an amount of change that equals the input. So for example if you were to enter 10 bucks it might come out with 1,000 pennies and if you were to in put that again it might come back with 100 dimes or a combination of change.

The problem I'm having is getting the amount of change to equal the input. I can get it to randomly come up with different amounts of change the problem is that it just doesn't the equal input. I should mention this is all done under one function, or the main function.

Recommended Answers

All 5 Replies

For help you have to post your code,we can not guess how your code are set up.

Usually homework like that asks for change with the least amount of coins.

Here I'll give another example of what I'm trying to do.

Lets say you input a number and it creates an equation for that number so lets say you enter the number 9
It would create the equation through randomly going through the operators and numbers and print the equation 3^2*1

Or lets say the input was 7 it would print out the equation 3*2+1.

The problem I'm having is that the equation it prints does not match the number that was input. In my program it is able to create an equation randomly but it doesn't create the equation that is equal to the input. So what I'm asking for in this example is how would I be able to get it so that it knows to create an equation that would equal the number that was inputted?

I've been trying for statements but so far no success. I've also been trying while loops too.

So you want to go through
a op b op c
until the result matches your target.
Where a, b, c are integers and op are the various operators.
Right?

hi can you help me about lucky 9 game coding in python 2.5

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.