COSC 1336 | PyThon


Welcome to COSC 1336

About the Course

This is an introductory course in computer programming using Python. It covers preparatory computer science concepts that relate to programming. And, the Python language also receives substantial coverage. While there are no official course prerequisites, general computing skills are essential. For instance, students should be proficient with directory navigation, file creation/deletion/moving/copying, text editing, and basic numerical calculations. Unless you have considerable programming experience, this course will likely require a significant amount of time and effort. Students should budget at least five-to-ten hours per week to study the material and complete the assignments. Naturally, time requirements are influenced by a variety of factors such as previous experience, skills, and exposure to technical academic work. Five-to-ten hours is only an estimate and considerably more time may be required.


About Python

Python is a direct descendant of the 'ABC' programming language. However, the initial goal of Python was to be unlike ABC in many ways and to repair the perceived deficiencies. Although not formally considered a member of the 'C family' of languages which include C, C++, C#, Java, Perl, and PHP, Python's syntax was influenced by C. Instead of an emphasis on expanding the base Python language to accommodate new features, the focus has been on a small core language with an expansive library.

Guido van Rossum, a Nederlander and Python's principal designer and lead architect, has stated that Python began as a hobby project to appeal to computing language enthusiasts. From its humble beginnings, Python has grown into a widely used general-purpose programming language with a number of relevant applications such as: gaming, graphics, data mining, and embedded systems. See the site for implementation examples.

In this course we will begin with simple examples of Python which we will write with a basic text editor and execute in a command window like shown below. In the world of professional development, the majority of Python applications are written using an IDE (Integrated Development Environment) and produce graphical user interface (GUI) applications, analytical tools, or the server-side code supporting websites.

Even though the IDE is the standard development tool, by starting with the basics, we obtain a comprehensive foundation and an appreciation for the more powerful tools. Furthermore, by working with the command line, direct access to the interpreter will not be a mysterious alternative after using it for a few simple programs. The example below shows a basic 'hello world' program executed by the Python interpreter in interactive mode at the command prompt.


Another common way of interacting with Python at the command line is running code stored in a script file (.py). This next example shows the Python interpreter processing/running the '' file in script mode. The contents of the is shown next. It only includes the print line.


While Python can be used for a variety of development tasks such as numerical computing, server-side web components, and software testing, in this course we will use it to write desktop applications. We only consider writing code to target desktop personal computers since that subject contains more than an adequate supply of introductory material.


Above All Else - Code

There is a great deal of material to cover with Python, even in an introductory course. After initially considering a few programming theoretical foundations, we will get started writing code and stay in 'code mode' throughout the course. To learn software development or a new language, there is no substitute for exposure to the craft of coding. We will use the powerful PyCharm Pro Integrated Development Environment (IDE).

However, in the first few sections, we get back to basics by writing code in an interpreter window and observing execution in realtime. Then we will write code in a simple text editor to produce a source code file (with the extension .py). and use the command line to call the CPython bytecode compiler to convert our source code (.py file) into byte code. Naturally, professional software developers almost always use a tool like PyCharm to construct Python programs. However, to have a more complete understanding of the tools available, developers should also be familiar with the basics of the command line.

It is very important that you code the examples. After you have coded an example, verify that it functions as shown in the output. Then save the working version and make copies to work from so that you do not risk corrupting your original, working version.

I recommend the following approach when working through the text descriptions and code in the course. If possible, it is extremely beneficial for a software developer to use multiple monitors. Given the relatively low cost of sufficient monitors and a dual-monitor video card, the benefits are well worth the professional investment. First, open the chapter text explanations in the left monitor. Then, in the same chapter, scroll to the code in the right monitor. Read the text on the left while reviewing the code on the right. Use the same technique when comparing source code to its output. That is also an effective strategy when writing code. Add and make changes to code in one monitor while observing the output in the other. If you cannot use two monitors, then open two vertical windows on the same monitor to work through the course material. Be sure to code the projects as described in the chapter examples. Visual inspection of the code is not enough to learn the material.

As you progress through the chapters keep in mind that, when describing content in a code or image diagram, the text descriptions will 'always' refer to images below the text. This consistency is by design and is intended to make it easier for the reader to follow the text-to-image conversation.


Student Success Factors

Student Success Factors (SSFs) are those components required for student success in this course.


  1. Quality Content - Check. The material on this site supplies all of the information required to complete the assignments and prepare for the exams. In addition to this site, the vast information provided by online sources is also extremely valuable, especially in those situations when a student wants to exceed assignment requirements and go beyond course material.
  2. Prior Preparation - While there are no official prerequisites for the course, the student should be comfortable with general personal computing concepts such as file/folder management, word processing, and website navigation.
  3. Time Commitment - The student must have sufficient time to study the material and complete the assignments. Naturally, the time required will depend upon each student's current skills and previous experience. A reasonable approximation is that somewhere between 5-10 hours per week will be necessary for success.
  4. Following Directions - Computing is an engineering discipline and as such, detailed written instructions are customarily supplied to specify program requirements. Therefore, it is imperative that students read the specifications carefully and implement them completely and correctly in code. Read with discernment to understand and apply course information and instructions correctly.
  5. Motivation to Succeed - This is the most important of the SSFs. If the student has basic computing skills and the time to complete the course work, then success depends on the student's desire to succeed. There will be challenges such as software incompatibilities, inexplicable code errors, system errors unrelated to assignments, hardware crashes, data loss, other time responsibilities, etc. However, through it all, if you want to acquire the knowledge and skills offered by the course, then success is essentially guaranteed.