Created
April 11, 2021 00:45
-
-
Save ofelix03/d4a3c2f53c4b9817ba5951ced0ce41f1 to your computer and use it in GitHub Desktop.
computing-total-using-for-loop-bad
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fruits = [('orange', 1), ('mangoes', 2), ('pineapple', 3), ('banana', 4)] | |
| total_fruits = sum([fruit[1] for fruit in fruits]) | |
| print("total_fruits: ", total_fruits) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment