Group practice in problem design and problem solving

Slides:



Advertisements
Similar presentations
CATHERINE AND ANNIE Python: Part 3. Intro to Loops Do you remember in Alice when you could use a loop to make a character perform an action multiple times?
Advertisements

For loops Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas.
Input and Output Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Python Basics: Statements Expressions Loops Strings Functions.
Computer and Programming
String and Lists Dr. Benito Mendoza. 2 Outline What is a string String operations Traversing strings String slices What is a list Traversing a list List.
Chapter 10 Introduction to Arrays
Hand Crafting your own program By Eric Davis for CS103.
Program Design and Development
Computer Science 1620 Programming & Problem Solving.
Introduction to Python
Chapter 3 Planning Your Solution
Fundamentals of Python: From First Programs Through Data Structures
JS Arrays, Functions, Events Week 5 INFM 603. Agenda Arrays Functions Event-Driven Programming.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
Fundamentals of Python: First Programs
An Introduction to Textual Programming
Lists in Python.
General Programming Introduction to Computing Science and Programming I.
Chapter 6 Functions -- QuickStart. "The Practice of Computing Using Python", Punch & Enbody, Copyright © 2013 Pearson Education, Inc. What is a function?
Presenting results to the USER in a professional manner 1. semicolon, disp(), fprintf() 2. Placeholders 3. Special characters 4. Format-modifiers Output.
Introduction. 2COMPSCI Computer Science Fundamentals.
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
Introduction to Programming (in C++) Algorithms on sequences. Reasoning about loops: Invariants. Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept.
Computer Programming TCP1224 Chapter 3 Completing the Problem-Solving Process and Getting Started with C++
Introduction to Problem Solving. Steps in Programming A Very Simplified Picture –Problem Definition & Analysis – High Level Strategy for a solution –Arriving.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Looping and Counting Lecture 3 Hartmut Kaiser
9/14/2015BCHB Edwards Introduction to Python BCHB Lecture 4.
ECS 15 Variables. Outline  Using IDLE  Building blocks of programs: Text Numbers Variables!  Writing a program  Running the program.
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
Asking the USER for values to use in a software 1 Input.
Files Tutor: You will need ….
Trinity College Dublin, The University of Dublin GE3M25: Computer Programming for Biologists Python Karsten Hokamp, PhD Genetics TCD, 03/11/2015.
Lecture 6: Output 1.Presenting results in a professional manner 2.semicolon, disp(), fprintf() 3.Placeholders 4.Special characters 5.Format-modifiers 1.
HKOI Programming HKOI Training Team (Intermediate) Alan, Tam Siu Lung Unu, Tse Chi Yung.
How Are Computers Programmed? CPS120: Introduction to Computer Science Lecture 5.
More Sequences. Review: String Sequences  Strings are sequences of characters so we can: Use an index to refer to an individual character: Use slices.
Variables and Strings. Variables  When we are writing programs, we will frequently have to remember a value for later use  We will want to give this.
Trinity College Dublin, The University of Dublin GE3M25: Computer Programming for Biologists Python, Class 2 Karsten Hokamp, PhD Genetics TCD, 17/11/2015.
JavaScript Introduction and Background. 2 Web languages Three formal languages HTML JavaScript CSS Three different tasks Document description Client-side.
Midterm Review Tami Meredith. Primitive Data Types byte, short, int, long Values without a decimal point,..., -1, 0, 1, 2,... float, double Values with.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
CS100 - PYTHON – EXAM 2 REVIEW -ONLY THE VITAL STUFF- PYTHON STRING METHODS, LOOPS, FILES, AND DICTIONARIES.
Getting Started With Python Brendan Routledge
String and Lists Dr. José M. Reyes Álamo. 2 Outline What is a string String operations Traversing strings String slices What is a list Traversing a list.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
String and Lists Dr. José M. Reyes Álamo.
GCSE COMPUTER SCIENCE Practical Programming using Python
Introduction to Python
Introduction to Computing Science and Programming I
A Python Tour: Just a Brief Introduction
Variables, Expressions, and IO
Cracking the Coding Interview
Print slides for students reference
Topics Introduction to File Input and Output
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Programming Funamental slides
Coding Concepts (Basics)
String and Lists Dr. José M. Reyes Álamo.
Introduction to Python
Introduction to Python
Introduction to Computer Science
Unit 3: Variables in Java
Understanding Variables
General Computer Science for Engineers CISC 106 Lecture 03
Topics Introduction to File Input and Output
Introduction to Computer Science
Presentation transcript:

Group practice in problem design and problem solving Introduction to Computing Using Python Group practice in problem design and problem solving In this lesson, you will work together in small groups to design a programming problem such as might be given on a test (15-20 minutes) submit your problem to a Moodle forum solve one or two of the problems your class designs (15-20 minutes per problem) (one group should) present a solution (~10 minutes) (each person should) rate the programming problem for difficulty and clarity

Design a programming problem Introduction to Computing Using Python Design a programming problem Work together in small groups (for example, of three) to design a good programming problem (15-20 minutes) Your problem might be similar to Question 13 on Midterm 2. It would have these elements specify that the reader write a function that takes a file name as a parameter describe the content of the file (e.g., text or numbers or a combination; including punctuation or not ... ) specify a property of the input file that the function should compute specify whether to write the result to an output file or to return the result in a dictionary give an example of correct input and output

The content of the input file Introduction to Computing Using Python The content of the input file The input file could have any content made up of characters (text) It might be line-by-line content, such as A name followed by height and weight The lines of a poem or lyric A year followed by the 10 most popular baby names for that year Or it might be a block of text consisting of words separated by white space (white space includes spaces, tabs and end line characters) Or it might be a sequence of numbers (integers or floats) Use your imagination!

Tell the problem solver to analyze ... Introduction to Computing Using Python Tell the problem solver to analyze ... Some property or relationship of the elements on each line A person's name and the person's zodiac sign Length of the line (in words or characters) or the number of short words on a line, or the number of big numbers on a line ... OR Some property of the words in the file (without regard to the line structure) Length of words, or frequency of words Distribution of upper and lower case characters Words beginning (or ending) in a certain way, or containing certain characters Hint: what is to be analyzed will determine whether the solution should read the file all at once (using the read() method) or line by line (using a for loop or readline() or readlines() method)

How hard should your problem be? Introduction to Computing Using Python How hard should your problem be? Give your problem a reasonable level of difficulty A problem with a 3 line solution is probably too easy A problem with a 30 line solution is probably too hard Try to make the problem solver do some thinking ... (minutes of thinking, not hours) Make the solution use some combination (not necessarily all!) of things we have learned, such as data types (strings, lists, numbers) built-in operators and functions (in, not, len(), range() ) methods (append(), count() ) flow control structures such as the for loop and if statement

How to describe the problem Introduction to Computing Using Python How to describe the problem Make your description of the problem as clear and simple as possible Be specific about the parameters (input) to the function and the output of the function Give helpful hints and guidance Include a good example of input and output The example should be short enough so that the problem solver can follow your instructions for analyzing the input to arrive at the output The example should illustrate how to handle any different cases of input and clarify possible pitfalls

Solve the problem (15-20 minutes) Introduction to Computing Using Python Solve the problem (15-20 minutes) Work together in your small group to solve the problem Read the problem carefully. Discuss it and make sure that you agree on what it is the problem asks you to do. Work the example. Make sure that you arrive at the correct output. Share ideas how to approach the problem What value(s) do you need to keep track of? What variables do you need to store these values? Are there repeated operations? What control structure (loop) governs the repetition? Are there conditional operations? What are the conditions (Boolean expressions) for doing or not doing the operation? Make sure your code works on the example given Create your own test case and try your code on it

Present your solution (~10 minutes) Introduction to Computing Using Python Present your solution (~10 minutes) At the end of the allotted time, one group should present their solution In your own words, present your understanding of what the problem asks you to do Report the state of your solution What is the core problem and how does your code solve it? Your solution may not be complete or fully correct. (That is a common state of affairs.) Convey the state of the solution, including any problems that you are aware of Does your code run or does it terminate with an error message? Does your solution give the same output as the example? If the output is not correct, where do you think the problem might lie?

Introduction to Computing Using Python Rate the problem Each person should rate the problem (for example, by a show of hands) On a scale of 1 to 5, how clear is the problem description? On a scale of 1 to 5, how difficult is the problem? Is the problem a reasonable test of what we have learned so far this semester?