import array
value = [6]
for index in range(0,6):
print "Enter Integer"
value.append(int(input()))
for index in range(0,7):
print "Integer = ",value[index]
value=[6,4,3,2,1]
for index in xrange(5):
print "Integer = ",value[index]
import array
def MAX_SIZE_CONST():
return 123
def TRAILER_CONST():
return -7777
value=array.array('i',[])
print "Enter upto",MAX_SIZE_CONST(),"using",TRAILER_CONST(),"as trailer :"
print ""
m=0
for index in range(0,int(MAX_SIZE_CONST())):
item=int(input())
if(item == int(TRAILER_CONST())):
break
else:
value.append(item)
m+=1
for index in range(0,m):
print "Integer =",value[index]
import array
k=0
sum=0.0
def MAX_STUD():
return 20
def ENDINP():
return -9999
mark=array.array('i',(0 for i in range(0,MAX_STUD())))
print "enter upto",MAX_STUD(),"marks:"
readin=int(input())
for index in range(0,MAX_STUD()):
if(readin != ENDINP()):
mark[index]=readin
readin=int(input())
k+=1
for index in xrange(0,k):
sum=sum+mark[index]
print "Average Mark = ",sum/k
import array
def MAX_SIZE():
return 10
#str=array.array('i',(0 for i in range(0,MAX_SIZE()+1)))
print "Enter the 10 letter word."
str=raw_input()
r=[]
for letter in str:
r.append(letter)
r.reverse()
print "word = ",str
print "".join(r)
import array
def MAX_SIZE():
return 20
size=0
variable =array.array('i',[])
while True:
print "Array-size : ?"
size=int(input())
if size>1 and size<MAX_SIZE():
break
print "Enter Numbers:"
for k in range(0,size):
m=int(input())
variable.append(m)
variable= array.array('i',sorted(variable))
print "Sorted Array is:"
for k in range(0,size):
print variable[k],
pox =[[0 for x in range(4)]for x in range(6)]
pox[0]=3,5,7,9,12,20
pox[1]=10,13,17,21,25,40
pox[2]=15,18,22,26,30,45
pox[3]=17,20,23,27,32,46
def read_city():
running=True
while running:
print "Which city?"
city=int(input())
if city == 0:
exit(1)
if city<4 or city>4 :
running=False
return city
def read_year():
running=True
while running:
print "Which year?"
year=int(input())
if year>1950 or year<2000 :
running=False
return year
def pop(x,y):
global pox
return pox[x-1][(y-1950)/10]
def output_city():
if city == 1:
return "Madurai"
elif city == 2:
return "Madras"
elif city == 3:
return "Bombay"
elif city == 4:
return "Calcutta"
runnable=True
city=read_city()
while runnable :
year=read_year()
print "Population in ",year,"of",output_city(),"is",pop(city,year),"Lakhs"
city =read_city()
if city == 0:
runnable=False