Debugging and Printing George Mason University. Today’s topics Review of Chapter 3: Printing and Debugging Go over examples and questions debugging in.

Slides:



Advertisements
Similar presentations
Lists and Strings George Mason University. Todays topics Review of Chapter 5: Lists and Strings Go over examples and questions lists and strings in Python.
Advertisements

User Defined Functions
Python Mini-Course University of Oklahoma Department of Psychology Lesson 28 Classes and Methods 6/17/09 Python Mini-Course: Lesson 28 1.
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 5 Functions for All Subtasks.
Def f(n): if (n == 0): return else: print(“*”) return f(n-1) f(3)
PHP Conditions MIS 3501, Fall 2014 Jeremy Shafer Department of MIS Fox School of Business Temple University September 11, 2014.
Μαθαίνοντας Python [Κ4] ‘Guess the Number’
Chapter 6: User-Defined Functions I
1 Session-14 CSIT 121 Spring 2006 Demo due today; demo hint was sent to your campus accounts Demo due today; demo hint was sent to your campus .
Python November 18, Unit 7. So Far We can get user input We can create variables We can convert values from one type to another using functions We can.
Chapter 6: User-Defined Functions I
Decision Making George Mason University. Today’s topics 2 Review of Chapter 2: Decision Making Go over exercises Decision making in Python.
Testing a program Remove syntax and link errors: Look at compiler comments where errors occurred and check program around these lines Run time errors:
1 Session-13 CSIT 121 Spring 2006 Test-1 is on March 9 th ; Demo-5 due date extended to March 7 Test-1 is on March 9 th ; Demo-5 due date extended to.
Genome Sciences 373 Genome Informatics Quiz Section 4 April 21, 2015.
Chapter 9 IF Statement Bernard Chen. If Statement The main statement used for selecting from alternative actions based on test results It’s the primary.
Chapter 9 IF Statement Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2012.
Munster Programming Training
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 6 Value- Returning Functions and Modules.
Test Driven Development George Mason University. Today’s topics Review of Chapter 1: Testing Go over examples and questions testing in Python.
Lecture 8: Choosing the Correct Loop. do … while Repetition Statement Similar to the while statement Condition for repetition only tested after the body.
COMP 171: Data Types John Barr. Review - What is Computer Science? Problem Solving  Recognizing Patterns  If you can find a pattern in the way you solve.
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 6: User-Defined Functions I.
Python Programming, 2/e1 Python Programming: An Introduction to Computer Science Chapter 6 Defining Functions.
Introduction to Java Lecture Notes 3. Variables l A variable is a name for a location in memory used to hold a value. In Java data declaration is identical.
Introduction to Computing Using Python for loop / def- ining a new function  Execution control structures ( if, for, function call)  def -ining a new.
1 SEEM3460 Tutorial Compiling and Debugging C programs.
Python Functions : chapter 3
CST229 Week 2 Questions or concern? Homework #1 due – Difference between permutation and no restrictions on using an element more than once. Code example:
PYTHON VARIABLES : CHAPTER 2 FROM THINK PYTHON HOW TO THINK LIKE A COMPUTER SCIENTIST.
PYTHON PROGRAMMING Week 4 - Wednesday. x = 1 while True: print "Too infinity and beyond! " + str(x) x +=1.
FUNCTIONS AND PARAMETERS CHAPTER Topics  Definition of a Function  Function Parameters and Arguments  Returning Values –Returning void  Naming.
Starting Out with Visual Basic.NET 2 nd Edition Chapter 6 Sub Procedures And Functions.
LECTURE 2 Python Basics. MODULES So, we just put together our first real Python program. Let’s say we store this program in a file called fib.py. We have.
Dictionaries and File I/O George Mason University.
Winter 2016CISC101 - Prof. McLeod1 CISC101 Reminders Quiz 3 next week. See next slide. Both versions of assignment 3 are posted. Due today.
Python focus – files The open keyword returns a file object Opening a file myFile = open('C:\file.txt', arg) Optional argument The second argument controls.
Quiz 3 Topics Functions – using and writing. Lists: –operators used with lists. –keywords used with lists. –BIF’s used with lists. –list methods. Loops.
Next Week… Quiz 2 next week: –All Python –Up to this Friday’s lecture: Expressions Console I/O Conditionals while Loops Assignment 2 (due Feb. 12) topics:
Topic: Python’s building blocks -> Variables, Values, and Types
Topic: Recursion – Part 2
Topic: Iterative Statements – Part 1 -> for loop
1-1 Logic and Syntax A computer program is a solution to a problem.
Topic: Python’s building blocks -> Statements
Topic: Functions – Part 2
Functions CIS 40 – Introduction to Programming in Python
Topics Introduction to Repetition Structures
Barb Ericson Georgia Institute of Technology Dec 2009
Call Stacks, Arguments and Returns
2008/10/27: Lecture 13 CMSC 104, Section 0101 John Y. Park
Chapter 5 Function Basics
Lecture Notes – Week 3 Lecture-2
The University of Texas – Pan American
Copyright © by Curt Hill
Python 21 Mr. Husch.
2008/10/27: Lecture 13 CMSC 104, Section 0101 John Y. Park
Topics Introduction to Value-returning Functions: Generating Random Numbers Writing Your Own Value-Returning Functions The math Module Storing Functions.
Assignment Operators Topics Increment and Decrement Operators
Assignment Operators Topics Increment and Decrement Operators
Assignment Operators Topics Increment and Decrement Operators
Functions By Anand George.
Topic: Iterative Statements – Part 2 -> for loop
Class code for pythonroom.com cchsp2cs
Assignment Operators Topics Increment and Decrement Operators
def-ining a function A function as an execution control structure
Assignment Operators Topics Increment and Decrement Operators
CMPT 120 Lecture 19 – Unit 3 – Graphics and Animation
Lecture 20 – Practice Exercises 4
Programming Techniques
Chapter 4 Test Review First day
Presentation transcript:

Debugging and Printing George Mason University

Today’s topics Review of Chapter 3: Printing and Debugging Go over examples and questions debugging in Python

Debugging and printing review How do we trace through code by hand? What is a print statement? How is it different than a return statement? What is a function? How do we call one?

Let’s go over the exercises

Printing and Functions in python print is a keyword that prints out the expression that follows it str is actually a function that we call with an argument Any guesses what’s going on in the last and first line? (we’ll cover this in the future)

Debugging in python You can always use print statements to debug your code There are other tools that can save time if you just want to trace through the code once, not by hand: – – in-class demo

Questions?