I210 review.

Slides:



Advertisements
Similar presentations
I210 review Fall 2011, IUB. Python is High-level programming –High-level versus machine language Interpreted Language –Interpreted versus compiled 2.
Advertisements

Lilian Blot CORE ELEMENTS COLLECTIONS & REPETITION Lecture 4 Autumn 2014 TPOP 1.
I210 review (for final exam) Fall 2011, IUB. What’s in the Final Exam Multiple Choice (5) Short Answer (5) Program Completion (3) Note: A single-sided.
Guide to Programming with Python Chapter Seven (Part 1) Files and Exceptions: The Trivia Challenge Game.
Guide to Programming with Python Chapter Ten GUI Development: The Mad Lib Program.
If statements while loop for loop
Course A201: Introduction to Programming 12/9/2010.
More While Loop Examples CS303E: Elements of Computers and Programming.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter Six The Do Loop and List Boxes.
Python Programming Graphical User Interfaces Saad Bani Mohammad Department of Computer Science Al al-Bayt University 1 st 2011/2012.
Computing Science 1P Lecture 17: Friday 23 rd February Simon Gay Department of Computing Science University of Glasgow 2006/07.
Built-in Data Structures in Python An Introduction.
Applications Development
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 8 Lists and Tuples.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 13 GUI Programming.
Guide to Programming with Python Chapter Seven Files and Exceptions: The Trivia Challenge Game.
Tuples and Dictionaries Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg.
Guide to Programming with Python
CS190/295 Programming in Python for Life Sciences: Lecture 6 Instructor: Xiaohui Xie University of California, Irvine.
I NTRODUCTION TO PYTHON - GETTING STARTED ( CONT )
LISTS and TUPLES. Topics Sequences Introduction to Lists List Slicing Finding Items in Lists with the in Operator List Methods and Useful Built-in Functions.
Why Repetition? Read 8 real numbers and compute their average REAL X1, X2, X3, X4, X5, X6, X7, X8 REAL SUM, AVG READ *, X1, X2, X3, X4, X5, X6, X7, X8.
Introduction to Programming Python Lab 7: if Statement 19 February PythonLab7 lecture slides.ppt Ping Brennan
Python Files and Lists. Files  Chapter 9 actually introduces you to opening up files for reading  Chapter 14 has more on file I/O  Python can read.
Python Arithmetic Operators OperatorOperationDescription +AdditionAdd values on either side of the operator -SubtractionSubtract right hand operand from.
4 - Conditional Control Structures CHAPTER 4. Introduction A Program is usually not limited to a linear sequence of instructions. In real life, a programme.
Quiz 3 Topics Functions – using and writing. Lists: –operators used with lists. –keywords used with lists. –BIF’s used with lists. –list methods. Loops.
PYTHON PROGRAMMING. WHAT IS PYTHON?  Python is a high-level language.  Interpreted  Object oriented (use of classes and objects)  Standard library.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
IST 210: PHP Logic IST 210: Organization of Data IST2101.
CSC 108H: Introduction to Computer Programming Summer 2012 Marek Janicki.
CSC 108H: Introduction to Computer Programming Summer 2011 Marek Janicki.
Python Basics.
Chapter 2 Writing Simple Programs
Introduction to Programming
Chapter 4 The If…Then Statement
Topics Graphical User Interfaces Using the tkinter Module
Files and Exceptions: The Trivia Challenge Game
Python - Lists.
CS-104 Final Exam Review Victor Norman.
Scripts & Functions Scripts and functions are contained in .m-files
While Loops in Python.
Arrays, For loop While loop Do while loop
The relational operators
Exception Handling Chapter 9.
Selection CIS 40 – Introduction to Programming in Python
Introduction to Programming
Python Primer 2: Functions and Control Flow
Topics Introduction to File Input and Output
Chapter 7 Files and Exceptions
© Akhilesh Bajaj, All rights reserved.
Guide to Programming with Python
CS190/295 Programming in Python for Life Sciences: Lecture 6
Iteration: Beyond the Basic PERFORM
Introduction to Programming
Introduction to Programming
Introduction to Programming
Topics Sequences Introduction to Lists List Slicing
Python Primer 1: Types and Operators
ICT Gaming Lesson 3.
Chapter 3: Selection Structures: Making Decisions
Chapter 3: Selection Structures: Making Decisions
Topics Sequences Introduction to Lists List Slicing
More Loops Topics Relational Operators Logical Operators for Loops.
The University of Texas – Pan American
Introduction to Programming
Introduction to Programming
Introduction to Programming
Topics Introduction to File Input and Output
REPETITION Why Repetition?
Presentation transcript:

I210 review

About Final Exam When: 2:45-4:45 p.m., Thurs., May 7 Where: BU 400 What will be covered: Everything we talked so far (excluding the optional topics) If you attended most of the lectures, did the PLTL exercises, wrote your own codes, took the quizzes by yourself, you should have nothing to worry about the final exam! Guide to Programming with Python

Data Types Data type: sequences (containers) Strings (a sequence of letters) Tuples (a sequence of elements of any type; immutable) Lists (a sequence of elements of any type; mutable) Dictionary is NOT a sequence How to access the elements in a sequence Sequential access (using for and while loops) Indexing & Slicing Removing and adding elements Important sequence operators and functions, len([1, 2, 3]), ”a" in "abc", [1, 2, 3].index(1) Guide to Programming with Python

Branching Structures Branches based on a condition/conditions if if-else if-elif-else Condition: Expression that is True or False Often create conditions by comparing values Treating values as conditions: Any empty (None) or zero value is False Compound conditions (logical operators) Guide to Programming with Python

Loop Structure Need to know when and how to use for and while loops correctly for loops: iterate over the elements in a sequence while loops: repeat a block of code as long as a condition is insertion_sort.py Guide to Programming with Python

Functions How to write functions How to receive and return values Understand local and global variables Guide to Programming with Python

A Sample Question Write a function to translate temperate value in Fahreheit to Celcius. The function takes in two real numbers, minF and maxF through its parameters, which signify the minimum Fahrenheit and maximum Fahreheit temperature to display, as well as a third real number, step, which signifies the increment between temperatures to display. The function needs to display the Fahrenheit values between minF and maxF in increments of step in a table associated with their Celcius equivalents to the screen. Recall that the formula for converting a Fahrenheit temperature to Celcius is: C = (5/9) * (F-32) Guide to Programming with Python

Files How to use files text_file = open("read_it.txt", "r") Read from text files; readline(), readlines() Write to text files (permanent storage); write(), writelines() Need to open a file before using it, and close it when it is done How to extract information from the strings you read in from a text file! text_file = open("read_it.txt", "r") for line in text_file: line = line.strip() (name, score) = line.split() Guide to Programming with Python

A Sample Question Write a function that accepts a filename and reads in the comma-separated numbers from the text file. The function saves the numbers in a list, calculates and displays the average of the numbers, and return the list of numbers. Guide to Programming with Python

Handling Exceptions try: num = float(raw_input("\nEnter a number: ")) except(ValueError): print "That was not a number!" else: print "You entered the number", num Can add single else clause after all except clauses else block executes only if no exception is raised num printed only if assignment statement in the try block raises no exception Guide to Programming with Python

OOP How to create classes to define objects How to write methods and create attributes for objects How to instantiate objects from classes Understanding inheritance Derive new classes from existing ones Extend the definition of existing classes Override method definitions of existing classes Using modules Guide to Programming with Python

GUI Programming Events-driven programming! Work with a GUI toolkit Tkinter Create a root window and create a frame Create and use widgets Buttons; text entries; text boxes; check buttons; radio buttons Layout of the widget; grid() Create event handlers and bind (associate) events with event handlers Guide to Programming with Python

A Sample Question Guide to Programming with Python

Games Multiple choices only (no small questions) How to use livewires, override update() and constructor method in a class derived from the games.Sprite Understanding the important games objects (screen, keyboard, mouse) and classes (Sprites, Text, Message) Guide to Programming with Python

Test me Test if a function or a class works correctly by writing up a series of testing cases with different inputs Of course, you need to know what are the expected results Guide to Programming with Python