#------------------------------------------------------------------------------ # Loop4.py # Computes the nth Harmonic number: 1+1/2+1/3+...+1/n #------------------------------------------------------------------------------ n = 1000 sum = 0.0 for k in range(1,n+1): sum += 1/k print(sum) # try indenting this line # indentation in Python makes -all- the difference