Def squaresum(n) : # Iterate i from 1
Download 150.34 Kb.
|
python R J
def squaresum(n) : # Iterate i from 1 # and n finding # square of i and # add to sum. sm = 0 for i in range(1, n+1) : sm = sm + (i * i) return sm # Driven Program n = 5 print(squaresum(n))
x = input("Type a number: ") y = input("Type another number: ") sum = int(x) + int(y) print("The sum is: ", sum) a = int(input("Enter a first number\n")) b = int(input("Enter a second number\n")) c = a-b print("The result is",c) Download 150.34 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling