[ create a new paste ] login | about

Project: python
Link: http://python.codepad.org/H39AKoxz    [ raw code | output | fork ]

Python, pasted on Oct 11:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
pcount=0
ncount=0
zcount=0
n=5
arr=[]
for i in range(0,n):
    if(arr[i]>0):
        pcount=pcount+1
    elif(arr[i]<0):
        ncount=ncount+1
    else:
        zcount=zcount+1
pcountfr=float(pcount/n)
ncountfr=float(ncount/n)
zcountfr=float(zcount/n)
print(pcountfr)
print(ncountfr)
print(zcountfr)


Output:
1
2
3
4
Traceback (most recent call last):
  Line 7, in <module>
    if(arr[i]>0):
IndexError: list index out of range


Create a new paste based on this one


Comments: