samedi 3 janvier 2015

Doubt : Dictionary within a list through a random data stream



DISCLAIMER : THIS IS NOT A HOMEWORK QUESTION



Hi , I am a newbie to Python Programming and if I am violating some rules of Stack-Exchange , please tell me so .


I was reading up about dictionaries from the Python Tutorial and came across the following scenario .



Let us say that there exists a list : ['x','y','z',.....]

Now , I wish to generate a random data stream for each of the elements of the above list i.e. there will be a dictionary like : {'x':[0,0,70,100,...] , 'y':[0,20,...] , ...}

I wish to do this task dynamically i.e. using a loop - basically automated

At present I can do it statically i.e. by hard-coding it but that does not take me anywhere



My Doubt :


Can Someone help me out ?





Aucun commentaire:

Enregistrer un commentaire