Monday 2 September 2013

working with functons

LIST
food_list=["pepper","crab","vita","coal","chicken","pigfoot","oil"]
print food_list

boy_list=[]
print boy_list

print food_list[4]
#updating
food_list[6]="cassava leaf"
print food_list
#appending a list

food_list.append("onion")
print food_list
#creating a new list
house_list=[1,2,3,4,5]
x=food_list+house_list
print x
food_list.pop(2)
print food_list
print len(x)

#slicing list
z=x[5:]
print z

p=x[1:3]
print p
We are workng with intermediate functins. this is one of the functions, Built_in function. It provided as part of pyhon_raw_input(). type(). float,int().
Function is a reusable section of code written to perform a specific task. some of the key word we use in the function.
1,def

No comments:

Post a Comment