1 / 25

CSCI/CMPE 4341 Topic: Programming in Python Chapter 1: Introduction to Python

Learn the basics of Python programming, including the requirements of the course, components of a computer system, the evolution of programming languages, and the difference between structured programming and object-oriented programming.

violete
Download Presentation

CSCI/CMPE 4341 Topic: Programming in Python Chapter 1: Introduction to Python

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSCI/CMPE 4341 Topic: Programming in PythonChapter 1: Introduction to Python Xiang Lian The University of Texas – Pan American Edinburg, TX 78539 lianx@utpa.edu

  2. Objectives • In this chapter, you will • Know requirements of this course • Recall basic components in a computer system • Learn the evolution of programming language • Refresh your memory about the structured programming vs. object-oriented programming • History of Python

  3. Background Required • C++ Programming • If you made an A in 1370/1170 you will do fine with some effort • If you have already taken 2380, you will find this course not very difficult • You need to be able to look up how to get things done (for example, look up syntax)

  4. Programming, Programming, Programming • This class is unlike other courses in that you will spend a lot of time doing actual programming • You should never copy a program from someone else • Even if your program does not perform as good as someone else’s, you should submit what you have • You should not hesitate to ask questions in class

  5. Assignments • Unless I announce it, programs are due in one week after assignment is given in class, or posted • Occasionally, I will give two weeks for difficult programs • You should work on a program the same day it is assigned • That way you can ask questions during the following class period

  6. Use of the Textbook • I will not be covering chapter by chapter • I will cover important points needed to complete the assignments • You need to search the index in the back to find the topic needed for each assignment • You can also obtain help from websites of online resources

  7. Versions of Python • Python IDE software: • https://www.python.org/downloads/ • Python 2.2.X • Python 3.4.X • You will find differences for different versions Python • Thus, in your assignments, you need to specify which version (3.4.2 recommended) you are using

  8. The Time for Class • I expect to hold the class for little over an hour each time, with a 10-minute break • For assignments, please do not exchange programs with each other, just ideas • For projects, you can discuss the project with your study group members

  9. Study Group • Please form a team with 3-4 team members • Each team needs to finish one programming project, including: • A project report (e.g., problem description, background, solution, implementation, experimental settings, empirical evaluation, and screen captures of graphical interface); • A statement of tasks for each team member; • Source code; • Demonstration (5 minutes); and • Presentation (10-15 minutes).

  10. Python 3.4 Command Line Python 3.4 GUI

  11. CSCI 1380: Elements of a Computer System • Hardware • CPU • Main memory • Secondary storage • Input / Output devices • Software • System programs • Application programs (e.g. Python IDE)

  12. Programming Languages • Machine language • Assembly language • High-level language • E.g., Visual Basic, C, C++, Visual C#, Java, Python

  13. Structured (Procedural) Programming Technology • Early Software Development • Complex and costly for businesses (1960s) • Costs exceeded budgets • Final products unreliable • Research led to structured programming • Disciplined approach to programming • Programs clear and easy to modify • Several languages resulted from research • C, Pascal, Ada

  14. Object-Oriented Programming Technology • We humans are very good in recognizing and working with objects, such as a pen, a dog, or a human being • We learned to categorize them in such a way that make sense to us. • We may categorize them as animate object, inanimate objects, pets, friends, etc.

  15. Object-Oriented Programming Technology(cont'd) • We some times classify objects based on their attributes, for example, green apples or red apples, fat or slim people, etc. • If you think about it each object has many attributes. • If I ask you list the attributes of an orange, you probably could list many things such as color, shape, weight, smell, etc.

  16. Object-Oriented Programming Technology (cont'd) • In addition to attributes, all objects exhibit behaviors. • A dog eats, barks, wags its tail, plays, and begs. • A dog exhibits many more other behaviors than this short list. • Another thing we need to remember about objects is that objects interact between each other

  17. History of Python • Created in 1989 by Guido van Rossum • Created as a scripting language for administrative tasks • Based on All Basic Code (ABC) and Modula-3 • Added extensibility • Named after comic troupe Monty Python • Released publicly in 1991 • Growing community of Python developers • Evolved into well-supported programming language

  18. Python • Python is a scripting language • It is not compiled as an executable file • Python • Structured programming • Like C • Object-oriented programming • Like C++ • Class and object

  19. To Get Python Tutorial/Documentation • Visit: • Python How to Program, Deitel et al. • Learning to Program Using Python, Cody Jackson • Python Documentation

  20. Hello Program # Fig. 2.1: fig02_01.py # Printing a line of text in Python. print ("Welcome to Python Programming Class!") # Results: # Welcome to Python Programming Class! Note: parentheses are needed for Python 3.4.X, but not necessary for Python 2.2.X (used in Textbook)

  21. Hello Program (cont'd) • print ("Welcome to Python Programming Class!") • print ("-- Xiang!") ----------------------------------------------------------- • print ("Welcome to Python Programming Class! \n-- Xiang!")

  22. Your First Assignment • Assignment #1 • The purpose of this assignment is to practice writing to shell and command-line window using Python 3.4. It is a simple assignment. • Please submit Program listing and a screen capture of the program run. • Follow the textbook examples to add comments as documentation.

  23. Assignment Submission • Make sure to include your name, assignment number, date due and date completed on each assignment you submit • Assignment should be submitted in a zip folder with your name and assignment number appearing on the tab • Submit your assignments to the Blackboard

  24. Exercises • Install Python 3.4 on your machine • Find a good Python IDE (other than that on www.python.org) for programming graphical user interface (GUI) • How do you output the string “Total Square Feet: 1238” to the shell/command-line window. • Assume that 1238 in an integer stored in a variable called sqFt. • Describe 3 differences of Python from C++

More Related