Learning Scientific Programming with Python (2nd edition)

P4.4.1: Hailstone sequence generator with a usage message

Question P4.4.1

Modify the Hailstone sequence generator of Exercise P2.5.7 to generate the hailstone sequence starting at any positive integer, $n$, that the user provides on the command line (use sys.argv). Handle the case where the user forgets to provide $n$ or provides an invalid value for $n$ gracefully.