Download presentation
Published byAlexandra Marshall Modified over 9 years ago
1
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
2
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
3
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!
4
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)
5
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
6
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
7
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
8
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?
9
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?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.