PI. Dict methods

Run Settings
LanguagePython
Language Version
Run Command
# Here's just my favorit part of collective terms in English for different animals groups = { "alligator": "congregation", "wild cat": "destruction", "crow": "murder", "dolphin": "school", "elephant": "memory", "giraffe": "tower", "hound": "cry", "hedgehog": "array", "owl": "parliment", "turkey": "gang" } default_group = "group" animals = ["turkey", "bird", "owl", "hedgehog", "tiger"] for animal in animals: print "If my " + animal + " will find a friends the same kind as itself they\ will form the " + groups.get(animal, default_group) + "." groups.update({ "tiger": "ambush", "turkey": "rafter", "bird": "flock" }) print print for animal in animals: print "If my " + animal + " will find a friends the same kind as itself now\ they will form the " + groups.get(animal, default_group) + "." print print "List of all animals:", ', '.join(groups.keys()) print print "List of groups:", ', '.join(groups.values() + [default_group]) print for animal, group in groups.items(): print animal, "* 100 is", group
Editor Settings
Theme
Key bindings
Full width
Lines