In this lab you will do a little play with Python.
A Python loop
Write a Python program that prompts for a numbers and does the following for each input.
- If the input really isn’t a number, your program should print an error message.
- If the input is a negative number, your program should also print an error message.
- If the input is a postition number, your program should print a countdown sequences: something like 3,2,1,BLASTOFF.
Python lint
You should use the program pylint analyze your code. pylint is very helpful in finding syntax errors.
Python style
Python has an office style guide, PEP 8 - Style Guide for Python Code. If your program doesn’t conform to the style guide, pylint may complain.
Python IDE’s
Try out the two IDE’s available in the lab, idle and PyCharm (called simply charm).
Hashbang
Right now you are probably executing your program by typing:
[…]$ python yourprogram.py
Many years before tweets contained hashtags, Unix scripts contained
the hashbangs.
Add a hashbang to your Python program and rename it so that you can type
[…]$ ./yourprogram
to run your Python program.