CompSci 101 Introduction to Computer Science January 20, 2015 Prof. Rodger compsci 101, spring 20151.

Slides:



Advertisements
Similar presentations
CompSci 101 Introduction to Computer Science February 3, 2015 Prof. Rodger Lecture given by Elizabeth Dowd.
Advertisements

CompSci 101 Introduction to Computer Science Feb 26, 2015 Prof. Rodger.
Lists Introduction to Computing Science and Programming I.
School of Computing Science CMT1000 © Ed Currie Middlesex University Lecture 10: 1 TEST!!
CompSci 101 Introduction to Computer Science January 13, 2015 Prof. Rodger compsci 101 spring
CompSci 100e Program Design and Analysis II January 18, 2011 Prof. Rodger CompSci 100e, Spring20111.
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
Compsci 101.2, Fall PFTT (plan for this Thursday) l What is a Python program?  In the context of what we do in Compsci 101  In a neuroscience.
Lecture 06 – Reading and Writing Text Files.  At the end of this lecture, students should be able to:  Read text files  Write text files  Example.
Compsci 101.2, Fall Plan For the Week l Solve problems by programming in Python  Like to do "real-world" problems, but we're very new to the.
CompSci 6 Introduction to Computer Science October 20, 2011 Prof. Rodger.
Python Programming Using Variables and input. Objectives We’re learning to build functions and to use inputs and outputs. Outcomes Build a function Use.
CompSci 101 Introduction to Computer Science September 23, 2014 Prof. Rodger.
How to Read Code Benfeard Williams 6/11/2015 Susie’s lecture notes are in the presenter’s notes, below the slides Disclaimer: Susie may have made errors.
CompSci 101 Introduction to Computer Science Sept. 9, 2014 Prof. Rodger President Brodhead speech graduation 2010 CompSci 101 Fall
CompSci 6 Introduction to Computer Science November 1, 2011 Prof. Rodger.
CompSci 6 Introduction to Computer Science Sept 29, 2011 Prof. Rodger “All your troubles are due to those ‘ifs’,” declared the Wizard. If you were not.
Hossain Shahriar Announcement and reminder! Tentative date for final exam need to be fixed! We have agreed so far that it can.
CompSci 6 Introduction to Computer Science November 8, 2011 Prof. Rodger.
CompSci 101 Introduction to Computer Science November 18, 2014 Prof. Rodger.
CompSci 101 Introduction to Computer Science March 3, 2015 Prof. Rodger compsci101 spring151.
FUNCTIONS. Topics Introduction to Functions Defining and Calling a Void Function Designing a Program to Use Functions Local Variables Passing Arguments.
By Austin Laudenslager AN INTRODUCTION TO PYTHON.
CompSci 6 Introduction to Computer Science September 13, 2011 Prof. Rodger.
CompSci 101 Introduction to Computer Science March 31, 2015 Prof. Rodger Thanks to Elizabeth Dowd for giving this lecture Review for exam.
CompSci 101 Introduction to Computer Science February 10, 2015 Prof. Rodger “All your troubles are due to those ‘ifs’,” declared the Wizard. If you were.
CompSci 101 Introduction to Computer Science January 28, 2016 Prof. Rodger compsci101 spring161.
CompSci 101 Introduction to Computer Science February 4, 2016 Prof. Rodger compsci101 spring161.
CompSci 101 Introduction to Computer Science Feb 24, 2015 Prof. Rodger.
CompSci 101 Introduction to Computer Science January 26, 2016 Prof. Rodger compsci 101, spring
CompSci 101 Introduction to Computer Science November 11, 2014 Prof. Rodger CompSci 101 Fall Review for exam.
OCR Computing GCSE © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 3: Built-in functions.
CompSci 101 Introduction to Computer Science March 17, 2015 Prof. Rodger compsci 101, spring
CompSci 101 Introduction to Computer Science February 25, 2016 Prof. Rodger compsci101 spring20161.
CompSci 101 Introduction to Computer Science January 15, 2015 Prof. Rodger 1.
CompSci 6 Introduction to Computer Science September 27, 2011 Prof. Rodger CompSci 6 Fall
CompSci 101 Introduction to Computer Science February 16, 2016 Prof. Rodger “All your troubles are due to those ‘ifs’,” declared the Wizard. If you were.
CompSci 101 Introduction to Computer Science April 7, 2015 Prof. Rodger.
CompSci 101 Introduction to Computer Science March 24, 2016 Prof. Rodger compsci 101, spring
CompSci 101 Introduction to Computer Science March 8, 2016 Prof. Rodger.
CompSci 101 Introduction to Computer Science April 14, 2016 Prof. Rodger Lecture today by Sriram Vepuri.
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
CompSci 101 Introduction to Computer Science April 14, 2016 Prof. Rodger compsci101 spring161.
CompSci 101 Introduction to Computer Science February 5, 2015 Prof. Rodger Lecture given by Elizabeth Dowd compsci101 spring151.
Topics Introduction to Functions Defining and Calling a Void Function
CompSci 101 Introduction to Computer Science
Python: Experiencing IDLE, writing simple programs
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 6 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
COMPSCI 107 Computer Science Fundamentals
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
Functions CIS 40 – Introduction to Programming in Python
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
COMPUTER PROGRAMMING SKILLS
Introduction to Computer Science
More Basics of Python Common types of data we will work with
def-ining a function A function as an execution control structure
CompSci 101 Introduction to Computer Science
Programming Techniques
Presentation transcript:

CompSci 101 Introduction to Computer Science January 20, 2015 Prof. Rodger compsci 101, spring 20151

Announcements Reading, RQ 3 Due Assignment 1 due today, Assg 2 out! APT 1 is due on Thursday Finish lecture notes - last time for Sec 02 Today – more on functions, strings compsci 101, spring 20152

Python – Programming Concepts Names vs abstractions –What is –What is Types are important –What is foo.pdf, foo.mp4, foo.jpg, foo.wav –Do the file extensions guarantee file type? Python – what types are these? first = "Susan" x = 6 y = 3.4 compsci 101, spring 20153

Strings Sequence of characters in quotes "I" + 'Love' + '''Python''' "I" 'Love' '''Python''' 'ILovePython' String operators: concatenation (+), repeat(*) Precedence? "a" + "b" + "c" * 3 'abccc' Precedence? "a" + "b" "c" * 3 'abcbcbc' 4compsci 101, spring 2015

Strings Sequence of characters in quotes (same result) "I" + 'Love' + '''Python''' "I" 'Love' '''Python''' 'ILovePython' String operators: concatenation (+), repeat(*) Precedence? "a" + "b" + "c" * 3 'abccc' Precedence? "a" + "b" "c" * 3 'abcbcbc' 5compsci 101, spring 2015

Function def functionName(parameters): block of code Parameters – place holder, will store value passed in Arguments – values in the call, that you pass to the function to use as input 6compsci 101, spring 2015

Function – return or print? Example function that returns a value def sum(a, b): return a+b Example function that prints def hw(name): print "Hello " + name Call Functions print sum(4,7) hw("Sue") 7compsci 101, spring 2015

Old MacDonald Song Write a Program to print this song compsci 101, spring 20158

Function OldMacPig() compsci 101, spring 20159

Rest of Code Function OldMacCow –Replace “pig” with “cow” –Replace “Oink” with “Moo” Code to start: compsci 101, spring

Discuss how to make code better bit.ly/101S Describe in words how you can make the code better? More efficient? –Fewer lines of code? –Use more functions? –Discuss your changes. What advantages do the changes you make have? compsci 101, spring

OldMac3 bit.ly/101S Describe what makes this version of OldMacDonald better than the first version compsci 101, spring

OldMac3 - calls, and input passed pig OldMac main WithSound HadAnimal Refrain SayEIEIO OldMac Oink pig, Oink cow, Moo (rest not shown, similar to pic diagram) compsci 101, spring