

John Cole, PhD
Every Boilermaker Engineer Codes (EBEC)
Engineering Milestones
This course uses Python to introduce fundamental procedural and object-oriented programming concepts. Amongst the many topics covered are such diverse elements as variables, data structures (lists, tuples, dictionaries, and sets), file handling, decision structures, loops, functions and modules, as well as classes and objects, data attributes, and methods.
Prime Numbers: Python program that determines if a number is prime. A prime number is a number (not including 1) that is only evenly divisible by two numbers: itself and 1. For example, the number 5 is prime because it can only be evenly divided by 1 and 5. The number 6, however, is not prime because it can be divided evenly by 1, 2, 3, and 6. This program prompts the user to enter a number. If the user enters -1, then the program ends. Otherwise, a message is displayed indicating whether or not the number is prime.
Turtle Graphics - Star: Python program that draws a star using Turtle Graphics. Uses a loop with turtle graphics to draw a star pattern that has a user specified number of points. First, asks the user how many points they want on the star. Then a star is drawn by having the turtle trace its perimeter.
​
Algorithm: The inner angle of a star point A will be equal to 360â—¦ divided by the number of points on the star: A = 360â—¦/points. The concave angle between star points B will be twice the inner angle.
File Stats: Reads in a file and generates simple statistics on the file. Python program reads the contents of a file and determines the number of words in the file, the number of non-blank lines in the file, and average number of words per nonblank line. The file is specified by the user through an input prompt. A word is defined as any group of contiguous non-blank characters separated from other characters by whitespace. The file frontiero_v_richardson.txt is provided as an example to test the application with the expected output of: Total number of words: 1271 Total number of lines: 61 Average number of words per line: 20.8
State Quiz: Quiz on U.S. capitols written in Python. This program will quiz the user by asking them to enter the capital for a particular state. The states are asked in a randomized order and the answers are not case sensitive. If the user answers correctly, that state is not asked again. If the user answers incorrectly, the state is added to the end of the quiz so that it will be asked again. This allows states to be asked as many times as necessary for the user to answer correctly. The program ends after all of the state capitals have been entered correctly or the user enters ‘0’. The program also tracks the number of correct and incorrect responses. At the end of the quiz it reports how many questions were answered correctly and how many in total were asked. The program assumes that the state names are unique, but does not assume that the state capital names are unique.
Battleship: Simulates single-player battleship game. Ships are a mothership (5 spaces, X-pattern), battleship (4 spaces, square pattern), destroyer (3 spaces, triangle pattern), stealth ship (3 spaces, single line), and patrol ship (2 spaces, single line). Includes high score hall of fame output.