1 / 18

MCS 177 Lab Fall 2014

MCS 177 Lab Fall 2014. Sept. 2, 2014. MCS 177, 9/2/14. Contact Info. Course Instructor: Louis Yu lyu@gustavus.edu Lab Instructors: Mike Hvidsten hvidsten@gustavus.edu Jeff Engelhardt jengelha@gustavus.edu Lab Assistants 11:30: Andrew Haisting ( ahaistin@gustavus.edu )

hop-langley
Télécharger la présentation

MCS 177 Lab Fall 2014

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. MCS 177 Lab Fall 2014 Sept. 2, 2014

  2. MCS 177, 9/2/14 Contact Info Course Instructor: Louis Yu lyu@gustavus.edu Lab Instructors: Mike Hvidsten hvidsten@gustavus.edu Jeff Engelhardt jengelha@gustavus.edu Lab Assistants 11:30: Andrew Haisting (ahaistin@gustavus.edu) 2:30: Dustin Luhmann (dluhmann@gustavus.edu)

  3. MCS 177, 9/2/14 Today’s schedule Course/Lab Details Python and Idle Python Intro (Sec 1.1-1.5 in textbook) Tasks 1 and 2 of Project 1 (if time)

  4. MCS 177, 9/2/14 Course/Lab Course Website: www.gac.edu/~lyu/teaching/mcs177-f14/ Lectures – Monday, Wednesday, Friday Read Assigned sections before class (see class schedule) Lab Work – Tuesday, Thursday Projects are linked from course site This week – Intro (nothing to hand in) Submit code via Moodle Lab notes/slides at www.gac.edu/~hvidsten/courses/MC177

  5. MCS 177, 9/2/14 Python – Course Programming Language Python is an open source scripting language. Developed by Guido van Rossum in the early 1990s Named after Monty Python Available on MCS computers Available for download from http://www.python.org

  6. MCS 177, 9/2/14 Why Python? • Simple Syntax – we can focus on solving problems, learning concepts, not coding syntax • Object-Oriented – all values are essentially objects • Widely used (Google spider and search engine) • Powerful String and Math libraries • Dynamic Typing: Variables do not need to have pre-defined types

  7. MCS 177, 9/2/14 Idle GUI Environment:

  8. MCS 177, 9/2/14 Let’s Get Started! Log on to your computer (user name = email name) Start Idle Try some basic arithmetic examples

  9. MCS 177, 9/2/14 Arithmetic Operations

  10. MCS 177, 9/2/14 Numerical Data Types Integer (int) vs Floating Point (float) How can we tell which is which? A numeric value without a decimal point produces an int value A numerical value that has a decimal point is represented by a float (even if the fractional part is 0)

  11. MCS 177, 9/2/14 Numerical Operations Operations on ints produce ints (except for /) Operations on floats produce floats, Mixed operations are converted to floats >>> 3.0+4.0 7.0 >>> 3+4 7 >>> 3.0*4 12.0 >>> 3*4 12 >>> 10.0/3.0 3.3333333333333335 >>> 10/3 3.3333333333333335 >>> 10 // 3 3 >>> 10.0 // 3.0 3.0

  12. MCS 177, 9/2/14 Variable Assignment (Section 1.5) • As in mathematics, much of the power of computer programs is in the use of variables • Python variables are identified by name • Must start with a letter • Ex: x=2, a_1 = x+3

  13. MCS 177, 9/2/14 Example • We want to calculate the volume of a cylinder • volume = area of base * height • Variables?

  14. MCS 177, 9/2/14 Example

  15. MCS 177, 9/2/14 Diagram for Simple Assignment in Python

  16. MCS 177, 9/2/14 Changing Radius value has no effect on cylinderVolume! Why not? 10.0

  17. MCS 177, 9/2/14 How do we make change? • Need to re-evaluate baseArea and cylinderVolume

  18. MCS 177, 9/2/14 If time, Start working on Tasks 1 and 2 of Project 1

More Related