Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

sum of fraction numbers in python

# 1*1 + 2*2 + 3*3 + ........ + n*n = Sum
inpt = int(input("Enter range = "))
sum = 1
for x in range(2, inpt + 1, 1):
    sum += 1 / x

print("%.2f" % sum)
Comment

PREVIOUS NEXT
Code Example
Python :: python bot ban script 
Python :: datetime time set seconds 
Python :: rename last layer of keras model 
Python :: create instances of a class in a for loop 
Python :: python string not contains 
Python :: cin python 
Python :: executing a python script interactively 
Python :: Python use number twice without assignment 
Python :: matplotlib yaxis off 
Python :: datatime add time in float 
Python :: List Comprehension build a list of tuples 
Python :: cannot create group in read-only mode. keras 
Python :: pandas most and least occurrence value 
Python :: midpoint circle drawing algorithm 
Python :: how to make a new key in a dictionary python 
Python :: plotting mean in density plot ggplot2 
Python :: Converting categorical variable to numeric variable in python 
Python :: h2o ai python 
Python :: python download images from unsplash 
Python :: binary tree python implementation 
Python :: get second min no from array in python 
Python :: how to find min, max in dictionaries 
Python :: encapsulation in python 
Python :: Finding if 2 consecutive numbers in a list have a sum equal to a given number 
Python :: add values to dictionary key python 
Python :: python get time executed by function 
Python :: python binary tree search 
Python :: python dictionary get vs setdefault 
Python :: select column in pandas dataframe 
Python :: format numbers in column to percentage in python 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =