all valid python 3

This commit is contained in:
Alex Brown
2018-10-20 14:45:08 -05:00
parent b566055e4b
commit ea2ddaaf6a
37 changed files with 76 additions and 1436 deletions

View File

@@ -12,9 +12,9 @@ from __future__ import print_function
suma = 0
sumb = 0
n = int(raw_input())
n = int(input())
for i in range(1,n+1):
suma += i**2
sumb += i
sum = sumb**2 - suma
print(sum)
print(sum)

View File

@@ -9,8 +9,8 @@ Hence the difference between the sum of the squares of the first ten natural num
Find the difference between the sum of the squares of the first N natural numbers and the square of the sum.
'''
from __future__ import print_function
n = int(raw_input())
n = int(input())
suma = n*(n+1)/2
suma **= 2
sumb = n*(n+1)*(2*n+1)/6
print(suma-sumb)
print(suma-sumb)