sec_8.py (215B)
1 # Sum of the series: 1 + 1/2 + 1/3 + ... + 1/n 2 n = int(input("Enter the value of n: ")) 3 sum_series = 0 4 for i in range(1, n + 1): 5 sum_series += 1 / i 6 print(f"Sum of the series up to {n} terms = {sum_series:.4f}")
Comprehensive codebase and coursework for the 4-year B.Sc. Computer Science Honours degree (WBSU)