Please 'am a new beginnger in python. I have been trying to solve these problems, but 'am always getting stuck. Can you please help me out:
1.
the output suppose to give me values, after running the program, I kept getting this:
2.
I am using python 2.5.1 version
1.
Code:
numBuckets = 8 buckets = [0] * numBuckets bucketWidth = 1.0 / numBuckets for i in range(numBuckets): low = i * bucketWidth high = low + bucketWidth buckets[i] = inBucket(list, low, high) print buckets
the output suppose to give me values, after running the program, I kept getting this:
Code:
>>>[none, none, none, none, none, none, none, none]
Code:
numBuckets = 8 buckets = [0] * numBuckets for i in list: index = int(i * numBuckets) buckets[index] = buckets[index] + 1
I am using python 2.5.1 version
Comment