this is a pure python implementation of the harmonic series algorithm https en wikipedia orgwikiharmonicseriesmathematics for doctests run following command python m doctest v harmonicseries py or python3 m doctest v harmonicseries py for manual testing run python3 harmonicseries py pure python implementation of harmonic series algorithm param nterm the last nth term of harmonic series return the harmonic series starting from 1 to last nth term examples harmonicseries5 1 12 13 14 15 harmonicseries5 0 1 12 13 14 15 harmonicseries5 1 1 12 13 14 15 harmonicseries5 harmonicseries0 harmonicseries1 1 pure python implementation of harmonic series algorithm param n_term the last nth term of harmonic series return the harmonic series starting from 1 to last nth term examples harmonic_series 5 1 1 2 1 3 1 4 1 5 harmonic_series 5 0 1 1 2 1 3 1 4 1 5 harmonic_series 5 1 1 1 2 1 3 1 4 1 5 harmonic_series 5 harmonic_series 0 harmonic_series 1 1
def harmonic_series(n_term: str) -> list:
    
    if n_term == "":
        return []
    series: list = []
    for temp in range(int(n_term)):
        series.append(f"1/{temp + 1}" if series else "1")
    return series


if __name__ == "__main__":
    nth_term = input("Enter the last number (nth term) of the Harmonic Series")
    print("Formula of Harmonic Series => 1+1/2+1/3 ..... 1/n")
    print(harmonic_series(nth_term))