MAX_REMIND=50
MSG_LEN=60
reminders = [['' for i in xrange(MSG_LEN+3)] for i in xrange(MAX_REMIND)]
num_remind=0
while(1):
if(num_remind==MAX_REMIND):
print "--No space left --"
break
li=raw_input( "Enter day and reminder: ")
li1=li.split()
day_str=li1[0]
if(day_str=='0'):
break
msg_str=li1[1:]
i=0
for i in range(num_remind):
if(day_str<reminders[i]):
break
j=num_remind
while(j>i):
reminders[j]=reminders[j-1]
j=j-1
reminders[i]=day_str
reminders[i]=str(reminders[i])+str(msg_str)
num_remind=num_remind+1
print ""
print "Day Reminder"
for i in range(num_remind):
print "%s"%reminders[i]
NAME_LEN=25
MAX_PARTS=100
num_parts=0
number1=[0]*100
on_hand1=[0]*100
name1=[0]*100
def find_part(number):
i=0
for i in range (i,num_parts):
if(number1[i]==number):
return i
return -1
def insert():
num_parts=0
if(num_parts==MAX_PARTS):
print "Database is full, cant add more parts"
return
part_number=int(raw_input("Enter part number: "))
if(find_part(part_number)>=0):
print "Part already exists"
return
number1[num_parts]=part_number
name1[num_parts]=raw_input("Enter part name: ")
on_hand1[num_parts]=raw_input("Enter quality on hand: ")
num_parts=num_parts+1
def search():
number=int(raw_input("Enter part number: "))
i=find_part(number)
if(i>=0):
print "Part name: %s" %name1[i]
print "Quantity on hand: %d"%on_hand1[i]
else:
print "Part not found"
def update():
number=int(raw_input("Enter part number: "))
i=find_part(number)
if(i>=0):
change=int(raw_input("Enter change in quantity on hand: "))
on_hand1[i]=on_hand1[i]+change
else:
print "Part not found"
while(1):
code=raw_input("Enter operation code: ")
if code=='i':
insert()
break
elif code=='s':
search()
break
elif code=='u':
update()
break
elif(code=='p'):
print()
break
print ""
import math
initial=float(raw_input("Enter initial value: "))
final=float(raw_input("Enter final value: "))
increment=float(raw_input("Enter increment: "))
print ""
print " x cos(x)"
print "-------------------------"
def tabulatec( first, last, incr):
num_intervals=int(math.ceil((last-first)/incr))
for i in range(num_intervals):
x=first+i*incr
print "%10.5f %10.5f"%(x,math.cos(x))
def tabulates( first, last, incr):
num_intervals=int(math.ceil((last-first)/incr))
for i in range(num_intervals):
x=first+i*incr
print "%10.5f %10.5f"%(x,math.sin(x))
def tabulatet( first, last, incr):
num_intervals=int(math.ceil((last-first)/incr))
for i in range(num_intervals):
x=first+i*incr
print "%10.5f %10.5f"%(x,math.tan(x))
tabulatec(initial,final, increment)
print ""
print " x sin(x)"
print ""
print "-------------------------"
tabulates(initial,final, increment)
print ""
print " x tan(x)"
print ""
print "-------------------------"
tabulatet(initial,final, increment)