'''
example 10.1 page no :103
'''
values = []
c = int(raw_input())
while(c != -1):
values.append(c)
c = int(raw_input())
size=len(values)
for i in range(size):
print values[i]
'''
example 10.2 page no :104
'''
import random
for i in range(4):
x = random.random();
print x
'''
example 10.3 page no :105
'''
import random
def randomVector(n,upperBound):
vec = []
for i in range(n):
vec.append(random.random () * 100 % upperBound)
return vec
def printVector(vec):
for i in range(len(vec)):
print vec[i] ,
numValues = 20;
upperBound = 10;
vector = randomVector (numValues, upperBound);
printVector(vector)
'''
example 10.4 page no: 106
'''
import random
def howMany(vec,value):
count = 0
for i in range(len(vec)):
if (vec[i] == value):
count += 1
return count
def randomVector(n,upperBound):
vec = []
for i in range(n):
vec.append(int(random.random () * 100 % upperBound))
return vec
numValues = 20;
upperBound = 10;
vector = randomVector (numValues, upperBound);
print "value \t howMany"
for i in range(upperBound):
print i , '\t' , howMany(vector, i)