Sep-26-2019, 02:34 PM
First of all, on line 8, '1' is not a number. '1' is a string because of the quotes. 1 (without quotes) is a number.
For the rest of it, it's not clear because we don't see how you call the function, so we can't see what numbers is. But if you are looping over band_values.items(), color is going to be a key from band_values, and value is going to be the value associated with that key. Since all of your keys are strings, color is always going to be a string. int is not going to help you here, because int('K') is going to throw an error too ('K' being one of the possible keys).
Now if you fix the problem I mentioned on line 8, then all of your values should be integers, and you probably want numbers[value] instead of numbers[color]. Also note that on line 15, band_values[color] is equal to value, so you might as well just use that. But then I'm not sure why you are checking
Finally, your while loop is going to go on forever. You only increase count if it is 9 or less, so count will always be 10 or less, and the condition of the while loop will always be True. Again, lack of clarity prevents me from knowing what a good fix would be.
For the rest of it, it's not clear because we don't see how you call the function, so we can't see what numbers is. But if you are looping over band_values.items(), color is going to be a key from band_values, and value is going to be the value associated with that key. Since all of your keys are strings, color is always going to be a string. int is not going to help you here, because int('K') is going to throw an error too ('K' being one of the possible keys).
Now if you fix the problem I mentioned on line 8, then all of your values should be integers, and you probably want numbers[value] instead of numbers[color]. Also note that on line 15, band_values[color] is equal to value, so you might as well just use that. But then I'm not sure why you are checking
value == numbers[value]
. Maybe you want numbers[count]? Again, it's not clear what is supposed to be happening here, so I'm not sure what the right answer is.Finally, your while loop is going to go on forever. You only increase count if it is 9 or less, so count will always be 10 or less, and the condition of the while loop will always be True. Again, lack of clarity prevents me from knowing what a good fix would be.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures