{ "cells": [ { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "233168" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "def divisible_by(n, ds):\n", " return any(n % d == 0 for d in ds)\n", "sum(n for n in range(1000) if divisible_by(n, [3,5]))" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.4" }, "title": "Multiplies of 3 and 5" }, "nbformat": 4, "nbformat_minor": 4 }