Feb-03-2019, 06:39 PM
i tried to run the part of the codes you wrote like this one:
>>> for i in range(1, 5): ... print(f'The first element of the list is {list(range(1, i+1))} with sum {sum(range(1, i+i))}') ... The first element of the list is [1]with sum 1 The first element of the list is [1, 2]with sum 3 The first element of the list is [1, 2, 3]with sum 6 The first element of the list is [1, 2, 3, 4]with sum 10and i am getting
Error: print(f'The element of the list is {list(range(1, i+1))} with sum {sum(range(1, i+i))}')
^
SyntaxError: invalid syntax