Created
April 11, 2021 00:43
-
-
Save ofelix03/0259c5b39facd21f85ea599e853fcad6 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 = 0 | |
| for fruit in fruits: | |
| total_fruits = total_fruits + fruit[1] | |
| print("total_fruits: ", total_fruits) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment