You can use a generator expression within the sum
function
>>> sum(i**i for i in range(1,11))
10405071317
More Related Contents:
- Checking sum of items in a list if equals target value
- Finding the longest substring of consecutive letters in python
- I cannot get the expected result
- In the last for loop I will to exclude execution of loop when Y=0 is met. How to I do it? [closed]
- Switch between two frames in tkinter?
- How to return dictionary keys as a list in Python?
- Why do I need ‘b’ to encode a string with Base64?
- FutureWarning: elementwise comparison failed; returning scalar, but in the future will perform elementwise comparison
- Django – No such table: main.auth_user__old
- How to change the color of certain words in the tkinter text widget?
- How to redirect stdout and stderr to logger in Python
- Accessing attributes on literals work on all types, but not `int`; why? [duplicate]
- How to escape curly-brackets in f-strings? [duplicate]
- NameError: global name ‘xrange’ is not defined in Python 3
- How to suppress or capture the output of subprocess.run()?
- How to make unicode string with python3
- PyYAML dump format
- Finding the nearest value and return the index of array in Python
- Set up Python simpleHTTPserver on Windows [duplicate]
- Error in Python script “Expected 2D array, got 1D array instead:”?
- Difference between AbstractUser and AbstractBaseUser in Django?
- Pip is not working for Python 3.10 on Ubuntu
- requests.get returns 403 while the same url works in browser
- Pandas ParserError EOF character when reading multiple csv files to HDF5
- What does colon at assignment for list[:] = […] do in Python [duplicate]
- Format a number with commas to separate thousands
- What is internal representation of string in Python 3.x
- AttributeError: Could not find PyAudio; check installation…can’t use speech Recognition
- Run process with realtime output to a Tkinter GUI
- how to add a coroutine to a running asyncio loop?