# eate a list called "content" which should contained all the contients and print
continent=['africa','antarctia','asia','austraclia','europe','northamerica','southamerica']
print continent
# print only the fifth(5)continent from the list
print continent[5]
# update the contient list by adding two plants earth and mars
continent.append('earth')
print continent
continent.append('mars')
print continent
#change the third contient on the list to pluto
continent[3]="pluto"
print continent
# print the number of items in the list
print len(continent)
#break the list into two
galaxy=continent[0:5]
print galaxy
space=continent[4:8]
print space
#adding "mercury" in the middle of the continent list and print
continent.insert(4,"mercury")
print continent
#by looping,print in the entire contients items
for items in continent:
print items
# create a list of thencountries in africa and print using loop
african_countries=['nigeria','ethiopia','egypt','congo','southafrica','tazania','kenya','algeria','unganda','sunda','morocco','ghana','mozanbique','ivorycoast',
'madagasca','angola','cameroom','niger','burkinafsco','mali','malawi','zambia','senegal','zimbawe','chad','guinea','gunisia','rwanda','benin',
'somila','burund','togo','liba','sierraleone','centralafricarepublic','emtrea','republicofcongo','liberia','mauritania','gabon','nimibia',
'botswana','lesotho','equatorialguinea','gambia','guineabossau','mauritius','swaziland','djbouti','reunionfrance','westernsahara','capeverde',
'mayotte(france)','saotomeandprincipe','seychelles','sainthelena']
for country in african_countries:
print country
# Delete the list called "space"
del(space)
print continent
# working with Dictionary
liberia={'bomic':'gola','bong':'kpelleh','gbarpolu':'dee','grandbassa':'bassa','grandcapemount':'vai','grandgeddeh':'krahn','grandkru':'kru','lofa':'lorma',
'margiba':'menda','monserrado':'english','nimba':'gio','rivercess':'bassa','rivergee':'kru','sinoe':'kru'}
print liberia
# print the ninth key in the dictionary
print liberia['margiba']
# the value fullah key to the key normans
liberia['normans']='fullah'
print liberia
#create an empty dictionary call street and assigned numbers to them as values print the dictionary
street={}
street['center']=20
street['broad']=23
street['clay']=40
street['front']=26
street['benson']=50
print street
# delete anyone of the items from the dictionary liberia
del (street['clay'])
print street
#add a key drapline to the street dictionary and add 8,3,11,2 as values and print
street['drapline']=[8,3,9,11,2]
print street
#sort the list that was added to drapline in the street
street['drapline'].sort()
print street
#creat your own dictionary of five words
vocationalschool_college={'cheale':'behind lonestar','ilab':'behind jfk','umu':'ashumstreet','lu':'capitol','stmary':'dula'}
print vocationalschool_college
No comments:
Post a Comment