Dictionary comprehension - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: Dictionary comprehension (/thread-17107.html) |
Dictionary comprehension - pawlo392 - Mar-28-2019 Hello! I want to write a function ,def count_words_starting_with_given_letter(text, letter):, for example: print(count_words_starting_with_given_letter('Tom has tiger ', 't') == {'Tom': 1, 'tiger': 1}). I know how to write code, but I have to use dictionary comprehension and I am little confused. RE: Dictionary comprehension - Yoriz - Mar-28-2019 Here's a forum link Thread-Comprehension-Expressions If get stuck, post the specific part your stuck on with code in python code tags and any errors received in error tags. |