I'm just trying to get the mode of a list.
Here's the code I have that gathers the data and sorts it.  i just need to
be able to get the mode of a using a dictionary and i can't seem to figure
out anything. i'm completely lost. this code works fine, i just need to add
to it and i'm not great with dictionaries.

#gather data
a=[]
prompt='Enter numbers, blank line to finish:'
inVal=raw_input(prompt)
while inVal:
    a.append(int(inVal))
    inVal=raw_input(prompt)
print 'The values you entered:'
print a

#Bubble Sort
i=0
while i<len(a):
    j=1
    while j<len(a)-i:
        if a[j-1]>a[j]:
            temp=a[j]
            a[j]=a[j-1]
            a[j-1]=temp
        j=j+1
    i=i+1
print 'Values sorted: ' ,a
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to