Lab 5: Structured Programming II
|
|
- Bruce Atkins
- 5 years ago
- Views:
Transcription
1 5.1 Introduction Lab 5: Structured Programming II Lab this week is going to focus on debugging, list comprehensions, and loading data from files. 5.2 Resources The additional resources required for this assignment include: 0 Books: Punch & Enbody 0 Pratt Pundit Pages: Python:Turtle 0 Lab Manual Appendices: None 5.3 Getting Started 1. Log into one of the PCs in the lab using your NET ID. Be sure it is set to log on to WIN. 2. In Windows: (a) Mount your CIFS drive - start a browser and point it to: Follow the instructions; for step 4, only the first bullet applies. (b) Start a browser and point it to: Check out the Using the PCs to Run Unix Programs Remotely section for how to get connected and make sure the connection is working. (c) Start Spyder. In the start menu, there is a group for Anaconda; Spyder is in that group. 3. In UNIX: (a) Change into your folder for EGR 103L, create a lab5 folder inside it, then switch into that folder: cd /EGR103 mkdir lab5 cd lab5 (b) Copy the tar file from Dr. G s space into your lab5 folder and expand the tar file: wget people.duke.edu/ mrg/egr103public/lab5files.tar tar -kxvf Lab5Files.tar (c) Make a personal copy of the lab report skeleton: cp -i Lab5Sample F18.tex lab5.tex 5 1
2 5.4 Ungraded You should look at, and if possible work on, 0 P&E Chapter 3 Exercises P&E Chapter 4 Exercises 1-22, 29-32, 37, 41, 48 For these ungraded problems, you can compare answers and processes with classmates. Do not share answers outside of those people currently taking the course. 5.5 Useful Information String and List functions 0 Some methods return values without impacting the original argument variable and others impact their arguments (and may not return anything). Since strings are immutable, methods that act on strings fall into the first category. 0 For strings, some of the methods that return new strings are capitalize, lower, swapcase, title, and upper. The methods do not change the original string but return a modified version of it based on the rules of the function. 0 Other commands that take a string and return information based on the string without changing the string are count, find, index, replace, and split. 0 Some methods that work with lists return values without changing the original list. These include count and index. 0 Finally, some methods that work on lists actually change the list. These include pop (which changes the list by removing an element and also returns the element popped out), remove (which removes the first element matching the argument of remove, does not return anything, and throws an error if there is no match). Debugging Introduction As you start writing more and more complicated codes, and as those codes rely more and more on functions, you need to learn more about how to debug code. Spyder includes tools to access some of the features of pdb, the Python debugger. These tools will allow you to step through a program, engage with the current environment (which is extremely helpful in debugging code inside a function), and even make temporary changes on the command line to see how those how the code works going forward. The debugging tools are the blue icons at the top of the Spyder window. First, you will want to go through an article, Debugging in Python, which was written in 2009 on a blog, Python Conquers the Universe. The post is at: https :// pythonconquerstheuniverse. wordpress. com /2009/09/10/ debugging -in - python / There are also some videos to help with debugging: quick demo on how to set and use a breakpoint. Be sure to save the file after setting a breakpoint demo using turtle drawings to show how to debug. Note: the program as given in the video will not always work with the latest version of Python or Spyder. Instead, a code that will work is in the files you copied this week. Spring 2018 APTs As mentioned in class Monday, you are going to be working on some of the APT (Algorithmic Problem-solving Testing) problems from Computer Science 101. You will be able to test the APTs yourselves and there s generally no reason not to get full credit for an APT problem. Please note - for these program, while you are allowed to import the math module, you are not allowed to give it a nickname. That is, if you want to use math, you can have the import math line and prepend math. in front of functions; you are not allowed to use import math as m. You cannot import numpy. 5 2
3 Turtles For part of this lab, you will be learning how to use turtle graphics to make a drawing. You will want to read along with Chapter 4 of the Downey online book. One quick note - for some reason, the current version of Spyder and Python generate an error every time a new turtle is created. For that reason, scripts will generally need to have the following to work: #%% Imports import t u r t l e #%% Generate window and t u r t l e wn = t u r t l e. Screen ( ) try : kasa = t u r t l e. Turtle ( ) except : kasa = t u r t l e. Turtle ( ) #%% Draw t h i n g s #%% Done drawing # This w i l l c l o s e the t u r t l e screen when you c l i c k on i t in Windows from sys import platform i f platform== win32 : wn. e x i t o n c l i c k ( ) The try...except structure seems redundant but it solves the feature of turtle creation working only every other time. This should generally be the wrapper of any turtle-based work. Note that you can issue turtle commands in the console - just remember when you create the turtle there is half a chance that you will get an error (it tells you that it is going to raise Terminator, then Terminator appears Experiments show that trying either sarah connor = t u r t l e. Turtle ( ) or john connor = t u r t l e. Turtle ( ) do not fix the issue. The following sub-sections will note changes or clarifications of the sections of the Downey book. Downey 4.1 The turtle module Instead of what is given on the page, your mypolygon.py script will look like: import t u r t l e wn = t u r t l e. Screen ( ) try : bob = t u r t l e. Turtle ( ) except : bob = t u r t l e. Turtle ( ) print ( bob ) from sys import platform i f platform== win32 : wn. e x i t o n c l i c k ( ) You will add code to the script after the print line but before the exitonclick line to make the square. 5 3
4 Downey 4.3 Exercises In each case, be sure to use the wrapper presented above around your script. Note that all of these functions should be defined in the mypolygon script. Downey 4.12 Exercises The solution scripts do not have the wrapper codes in them and will cause problems with Python and Spyder if run as-is. If you download the solution codes, be sure to add the wn = t u r t l e. Screen ( ) try : bob = t u r t l e. Turtle ( ) except : bob = t u r t l e. Turtle ( ) to the start of the main part of the code and change the end to: from sys import platform i f platform== win32 : wn. e x i t o n c l i c k ( ) 5.6 Assignment APT for Lab 5 For lab this week, you should work on and complete the following problems from: https :// www2.cs.duke. edu / courses / spring18 / compsci101 / apt / secure / Create a folder called APT in your CIFS EGR103 folder and put your files for this part of the assignment there. Please note - if you took CS 101 and have previously worked on these problems, you are allowed to re-submit your previous work but are highly encouraged to go back through the work you did 0 Problem Set 1: Gravity, Bogsquare 0 Problem Set 2: Laundry, DNAcgratio, PortManteau, RemoveMiddle 0 Problem Set 3: Bagels, ScoreIt, IsSpecial 0 Problem Set 4: MorseLikeCode (we ll talk about this one in lab) Please note - these are individual assignments. You can discuss your code with the TAs or the instructor but should work on your own. Also, some of these assignments may be active assignments for CS sharing solutions to active assignments with students in other classes is academically dishonest and deserving of engagement with the conduct board. After things are graded, comparing codes is a great way to learn. The first time you try to submit an APT for grading you will likely get an error that the file cannot be moved. Simply go back to the previous page, re-indicate what file you want to upload and which assignment you are hoping to try, and submit again. After you have completed all ten programs, click the check submissions link at the top of the page - a TA can go through and check the score for your ten problems. You will not need to submit these scripts with Lab 5, but they do need to be in your EGR103/APT folder. 5 4
5 5.6.2 Koch Curve The Koch curve, named for Helge von Koch, is a shape built using a recursive algorithm as follows - take a line segment and then as described on the Koch Snowflake page on Wikipedia: https :// en. wikipedia. org / wiki / Koch_snowflake (1) divide the line segment into three segments of equal length. (2) draw an equilateral triangle that has the middle segment from step 1 as its base and points outward. (3) remove the line segment that is the base of the triangle from step 2. The first application will create four equal-length segments. The recursive part is to then take each of those four segments and apply the above steps to those. This process can continue indefinitely. You are going to writing a script that will define a couple useful functions and then use them to generate a Koch curve based of a particular length and level. Your script will start with the following structure in the files you copied this week: #%% Imports import t u r t l e #%% Define f u n c t i o n s def koch curve ( t, length, l v l=0 ) : Draw Koch Curve o f given l ength and l e v e l i f l v l==0 : t. forward ( l e n gth ) # the r e s t i s yours to w r i t e def i n i t t u r t l e ( t ) : Set pen s i z e, speed, and c o l o r t. p e n s i z e ( 2 ) t. speed ( 0 ) t. c o l o r ( white ) #%% Main code i f s c r i p t i s run i f name == m a i n : wn = t u r t l e. Screen ( ) wn. c l e a r s c r e e n ( ) wn. b g c o l o r ( black ) try : kasa = t u r t l e. Turtle ( ) except : kasa = t u r t l e. Turtle ( ) # The r e s t i s yours to w r i t e from sys import platform i f platform== win32 : wn. e x i t o n c l i c k ( ) You will be writing a koch_curve function to generate a Koch curve. The function will have three inputs: a variable for the turtle, a variable for the line segment length, and a variable for the levels of recursion. To start, note that a level 0 Koch curve is merely a straight line of a given length. Your function has been started so that it moves the turtle forward by the specified length in cases where the level given is
6 Your code should create a curve that is 600 units wide and draw it going from left to right. The main part of your code should create the window and the turtle and then have the turtle start drawing at (-300, 0). You want to get there without the turtle actually drawing anything, however, so if your turtle s name is kasa, after you have created the turtle, use the commands: i n i t t u r t l e ( kasa ) kasa. penup ( ) kasa. s e t p o s i t i o n ( 300, 0 ) kasa. pendown ( ) This will set the turtle s size, speed, and color from the init_turtle function, then it will lift the pen before moving to the right location and putting the pen down. At this point, you could also add the command to create a level 0 curve with: koch curve ( kasa, 600 ) If you save and run this program, there should be a white line going from left to right in your Python Turtle Graphics window. Next, think about how to get from one level to the next. If someone asks for a level 1 Koch curve, that is going to be built of four level 0 Koch curves, each being one third of the given length and with turns between segments. Use a pen/pencil and paper to draw a Koch level 1 curve that is a total of 3 inches across. Note that each segment you draw will be 1 inch in length. Pay careful attention to how much you need to turn each time to head in the right direction. One you can do that on paper, you should be able to write the code for it. Your koch_curve for levels larger than 0 should include four different calls to the koch_curve function; these calls will each have the same shorter length and lower level than the original call. Re-read the paragraph above for a major hint on that. For this assignment, you can use whatever colors you want as long as the curve stands out from the background. The Pundit page has more information on colors. As you work on the code, you can use whatever color(s) you like for the line section(s) as long as it(they) contrast well with the background (which can also be the color of your choice). Once your program is working, use it to create a level 4 Koch curve. The way you will document your work this week will be to take a screen grab of the Python Turtle Graphics window. You will save the file and then upload it along with your Lab - that is, you will not be importing the picture in your lab document. There is more information on capturing the Python Turtle Graphics window on the Pundit page for Python:Turtle Based on P&E 4.46 For this problem, you are going to write a script that contains functions to process a word and then a phrase made up of words by encoding each word (almost) as described in the problem. There are several steps to performing this task - you should complete them one at a time and you should test your code every step of the way. Remember that you can put test code in the same scripts as your functions as long as you start that code with: i f name == m a i n : 0 First, note that the book has a small error in the encoding. If m were the 12th letter, that would mean a is zero and that you should in fact have the new number be 25-i. That s a little irrelevant in our case because your code is going to use ord() to get the numerical value of a character and chr() to get the character from an integer. Type: l i s t (map( ord, AZaz ) ) to see what Python thinks are the numerical values of those four letters. 0 Next, you are going to write a function whose job it is to take a single character, encode it as described in the book, and return the encoded character. Start this function with: def c o d e l e t t e r ( c h a r i n ) : and write code that assumes the char_in is a single letter string. For the moment, also assume that the character is a lower case letter. Figure out how to get your function to return the correctly encoded version of that single lower case letter. For example: 5 6
7 In [1]: code_letter ( c ) Out [1]: x In the main part of your code, you might want to run a loop that checks and prints out all the lower case numbers and their encoded letters. There are several ways to create this loop - one would be to loop over the numerical values of the letters and use ord() to convert the numbers to a letter. Write a loop that runs k through the numbers that represent lower case letters and put the following command in that loop: print ( chr ( k ), c o d e l e t t e r ( chr ( k ) ) ) 0 Now figure out how to deal with upper-case letters. The function should return upper-case letters if the original is in lower case. For example: In [1]: code_letter ( Q ) Out [1]: J You can either change your loop to go through just the upper-case letters, add a second loop to go through just the upper-case letters, or create an iterator including the lower-case and upper-case numbers. The latter is complicated by the fact that there is no + for the range command, but you can look at how: x = l i s t ( range ( 2, 10 ) ) + l i s t ( range ( 100, 110 ) ) to see how you might create a composite range. 0 Finally, if the input contains non-letter characters, the function should return the same non-letter character; add code to make this work: In [1]: code_letter ( ) Out [1]: To test your code, run your loop through the values 48 through 125; this represents all the numbers and letters and several symbols (which should remain unchanged). 0 Now that you are able to convert individual characters, you are going to write a second function that can convert entire strings. This function definition will come after the code_letter definition in your script. This function will take one required input - the old sentence - as well as an optional second input to determine if the old and new sentences should be printed on the screen. The function will return the encoded sentence. Start your function with: def code message ( o l d s e n t, show=0 ) : and before writing any more code, think about how you the human would use the code_letter to take a string and convert it to an encoded string one character at a time. You will want to build a string by appending the encoded characters. The good news is you do not have to worry about spaces between words - giving spaces to code_letter will automatically return spaces. Once you have this function completed, you can test it with: code message ( Let s Go Duke EGR 103 F a l l 2018, 1 ) and you should get: Let s Go Duke EGR 103 Fall 2018 Ovg h Tl Wfpv VTI 103 Uzoo 2018 Note the use of regular quotation marks to set off the input string since the apostrophe is a part of the string. Make sure that these tests are all in that if statement that will only run if you run the script as main. 0 To demonstrate how your code works, use the test_encoding script and pay careful attention to how it works - we will go over it in lab. The Coded.txt file will be a part of your lab report. 5 7
8 5.6.4 P&E 4.49 This problem is similar to the encoding problem, and you should thus break it down into parts. In a script called scrambler: 0 Define a function called scramble_word that you can assume takes a single word (i.e. letters only) as an input and returns the scrambled version. The scrambled version will start and end with the same letters as the original but the letters in the middle can be all mixed up. 0 The np.random.shuffle() function will be helpful here, but it only works on lists. If you were to want to scramble Pratt for example, you can slice the middle of the word to get a string m= rat but you cannot shuffle the letters with np.random.shuffle(m). You can shuffle a list of letters, however, so np.random.shuffle( list(m)) does work. Note that this command changes the list it is given it does not return anything. 0 After shuffling the interior letters, you can build the new word as a list and then convert that list to a string by using.join(). For example, look at how the following takes the letters sliced from Pratt and works to end with a string of shuffled letters: In [1]: x = rat In [2]: xlist = list (x) In [3]: xlist Out [3]: [ r, a, t ] In [4]: np. random. shuffle ( xlist ) In [5]: xlist Out [5]: [ a, r, t ] In [6]:. join ( xlist ) Out [6]: art Again - note that shuffle shuffles the entries in the list and changes that list - it does not return anything If you tried to get an output from line 4: In [7]: blah = np. random. shuffle ( xlist ) In [8]: print ( blah ) None 0 Test your function with one, two, and more than two letter words. Your tests should all be under a statement: i f name == m a i n : in your scrambler script. You can assume this function will only be getting words - no spaces, numbers, or punctuation marks. A quick test of your code might be to run the following loop: for k in range ( 20 ) : print ( scramble word ( AbcdefG ) ) If your code is working correctly, all 20 of the new words will start with A, end with G, and have various combinations of bcdef in the middle. 0 Now start a function called scramble_line that is going to take a line of text as an input, scrambles each word in that line of text, and returns a line of text now with the scrambled words. One easy way to split a line of text into individual words is to use the.split() function. This function acts on a string and returns a list of strings. The argument of the command is what character is used as the divider between strings in the original. The default is a space, though sometimes other characters might be useful depending on how you want to split things. Consider the following: 5 8
9 In [ 1]: all_ text = Gustafson, Michael Richard In [2]: all_text. split () Out [2]: [ Gustafson,, Michael, Richard ] In [3]: all_text. split (, ) Out [3]: [ Gustafson, Michael Richard ] (hint for a future APT and for this lab - that leading space in the second item can be removed with a convenient slice). 0 After you get a list of words, you should figure out how to get your scramble_line to scramble each word and then build a new string with the scrambled words. There should be spaces between the words, so you could get something like: In [ 1]: scramble_ line ( Duke University in Durham North Carolina ) Out [ 1]]: Dkue Unsritievy in Duahrm Ntroh Conlriaa 0 At present, this code does not handle punctuation. You will not be required to deal with punctuation except for items that come directly after a word (so periods, commas, colons, etc.). You will need to figure out how to check if a word ends with a non-letter. If it does, your program should store the non-letter, remove it from the word before sending the word to get scrambled, then return the non-letter to the end of the scrambled word. After you have this part working, you can test your code with an argument such as: In [1]: scramble_line ( Go Duke Where is Duke? Durham, North Carolina. ) Out [1]: Go Duke Whree is Dkue? Dahurm, Ntorh Coarnlia. You can program this to be dealt with either in the scramble_word code or in the scramble_line code. Again, think about what you the human would need to do if given something like Break Already? Python has a command to check letters called.isalpha() - note the following runs: In [1]: a. isalpha () Out [1]: True In [2]: aha. isalpha () Out [2]: True In [3]: aha. isalpha () Out [3]: False Again - for this you can assume that if there is any punctuation, it is at the end. about...well... don t. Don t worry 0 The test_scrambler code is already written. We wree gonig to have you wtrie it but ddiceed anigsat it. 0 You will include the results from the test code in the body of your lab report. 5 9
Lab 4: Structured Programming I
4.1 Introduction Lab 4: Structured Programming I Lab this week is going to focus on selective structures and functions. 4.2 Resources The additional resources required for this assignment include: 0 Books:
More informationCMSC 201 Spring 2017 Lab 12 Recursion
CMSC 201 Spring 2017 Lab 12 Recursion Assignment: Lab 12 Recursion Due Date: During discussion, May 1st through May 4th Value: 10 points (8 points during lab, 2 points for Pre Lab quiz) This week s lab
More informationn! = 1 * 2 * 3 * 4 * * (n-1) * n
The Beauty and Joy of Computing 1 Lab Exercise 9: Problem self-similarity and recursion Objectives By completing this lab exercise, you should learn to Recognize simple self-similar problems which are
More informationCMSC 201 Spring 2017 Lab 05 Lists
CMSC 201 Spring 2017 Lab 05 Lists Assignment: Lab 05 Lists Due Date: During discussion, February 27th through March 2nd Value: 10 points (8 points during lab, 2 points for Pre Lab quiz) This week s lab
More informationCMSC 201 Spring 2019 Lab 06 Lists
CMSC 201 Spring 2019 Lab 06 Lists Assignment: Lab 06 Lists Due Date: Thursday, March 7th by 11:59:59 PM Value: 10 points This week s lab will put into practice the concepts you learned about lists: indexing,
More informationCMSC 201 Fall 2016 Lab 09 Advanced Debugging
CMSC 201 Fall 2016 Lab 09 Advanced Debugging Assignment: Lab 09 Advanced Debugging Due Date: During discussion Value: 10 points Part 1: Introduction to Errors Throughout this semester, we have been working
More informationCS 051 Homework Laboratory #2
CS 051 Homework Laboratory #2 Dirty Laundry Objective: To gain experience using conditionals. The Scenario. One thing many students have to figure out for the first time when they come to college is how
More informationCMSC 201 Fall 2018 Lab 04 While Loops
CMSC 201 Fall 2018 Lab 04 While Loops Assignment: Lab 04 While Loops Due Date: During discussion, September 24 th through September 27 th Value: 10 points (8 points during lab, 2 points for Pre Lab quiz)
More informationCMPSCI 187 / Spring 2015 Hangman
CMPSCI 187 / Spring 2015 Hangman Due on February 12, 2015, 8:30 a.m. Marc Liberatore and John Ridgway Morrill I N375 Section 01 @ 10:00 Section 02 @ 08:30 1 CMPSCI 187 / Spring 2015 Hangman Contents Overview
More informationCS 1301 Individual Homework 3 Conditionals & Loops Due: Monday February 8 th before 11:55pm Out of 100 points
CS 1301 Individual Homework 3 Conditionals & Loops Due: Monday February 8 th before 11:55pm Out of 100 points Files to submit: 1. HW3.py THIS IS AN INDIVIDUAL ASSIGNMENT! You should work individually on
More informationSelf-Teach Exercises: Getting Started Turtle Python
Self-Teach Exercises: Getting Started Turtle Python 0.1 Select Simple drawing with pauses Click on the Help menu, point to Examples 1 drawing, counting, and procedures, and select the first program on
More informationCMPSCI 187 / Spring 2015 Hanoi
Due on Thursday, March 12, 2015, 8:30 a.m. Marc Liberatore and John Ridgway Morrill I N375 Section 01 @ 10:00 Section 02 @ 08:30 1 Contents Overview 3 Learning Goals.................................................
More informationArt, Nature, and Patterns Introduction
Art, Nature, and Patterns Introduction to LOGO Describing patterns with symbols This tutorial is designed to introduce you to some basic LOGO commands as well as two fundamental and powerful principles
More informationThe Beauty and Joy of Computing 1 Lab Exercise 9: Problem self-similarity and recursion - Python version
The Beauty and Joy of Computing 1 Lab Exercise 9: Problem self-similarity and recursion - Python version Objectives By completing this lab exercise, you should learn to Recognize simple self-similar problems
More informationAuthoring World Wide Web Pages with Dreamweaver
Authoring World Wide Web Pages with Dreamweaver Overview: Now that you have read a little bit about HTML in the textbook, we turn our attention to creating basic web pages using HTML and a WYSIWYG Web
More informationCMSC 201 Fall 2016 Lab 13 More Recursion
CMSC 201 Fall 2016 Lab 13 More Recursion Assignment: Lab 13 More Recursion Due Date: During discussion, December 5th through 8th Value: 10 points Part 1A: What is Recursion? So far this semester, we ve
More informationSCRATCH MODULE 3: NUMBER CONVERSIONS
SCRATCH MODULE 3: NUMBER CONVERSIONS INTRODUCTION The purpose of this module is to experiment with user interactions, error checking input, and number conversion algorithms in Scratch. We will be exploring
More information************ THIS PROGRAM IS NOT ELIGIBLE FOR LATE SUBMISSION. ALL SUBMISSIONS MUST BE RECEIVED BY THE DUE DATE/TIME INDICATED ABOVE HERE
Program 10: 40 points: Due Tuesday, May 12, 2015 : 11:59 p.m. ************ THIS PROGRAM IS NOT ELIGIBLE FOR LATE SUBMISSION. ALL SUBMISSIONS MUST BE RECEIVED BY THE DUE DATE/TIME INDICATED ABOVE HERE *************
More informationCISC 181 Lab 2 (100 pts) Due: March 4 at midnight (This is a two-week lab)
CISC 181 Lab 2 (100 pts) Due: March 4 at midnight (This is a two-week lab) This lab should be done individually. Labs are to be turned in via Sakai by midnight on Tuesday, March 4 (the midnight between
More informationENGR 102 Engineering Lab I - Computation
ENGR 102 Engineering Lab I - Computation Learning Objectives by Week 1 ENGR 102 Engineering Lab I Computation 2 Credits 2. Introduction to the design and development of computer applications for engineers;
More informationLab 6: Graphical Methods
Lab 6: Graphical Methods 6.1 Introduction EGR 53L - Fall 2009 Lab this week is going to introduce graphical solution and presentation techniques as well as surface plots. 6.2 Resources The additional resources
More informationComputer and Programming: Lab 1
01204111 Computer and Programming: Lab 1 Name ID Section Goals To get familiar with Wing IDE and learn common mistakes with programming in Python To practice using Python interactively through Python Shell
More informationDraw beautiful and intricate patterns with Python Turtle, while learning how to code with Python.
Raspberry Pi Learning Resources Turtle Snowflakes Draw beautiful and intricate patterns with Python Turtle, while learning how to code with Python. How to draw with Python Turtle 1. To begin, you will
More informationLaboratory Exercise #0
Laboratory Exercise #0 This assignment focuses on the mechanics of installing and using Python. The deadline for Mimir submission is 11:59 PM on Monday, January 8. 1. Complete the steps given below to
More informationLab 12: Numerical Differentiation and Integration
EGR 53L - Spring 2010 Lab 12: Numerical Differentiation and Integration 12.1 Introduction This lab is aimed at calculating derivatives and integrals of discrete data in MATLAB. At the end of the lab, you
More informationRecall that strings and tuples are immutable datatypes, while lists are mutable datatypes. What does this mean?
6.189 Day 4 Readings How To Think Like A Computer Scientist, chapters 7 and 8 6.01 Fall 2009 Course Notes page 27-29 ( Lists and Iterations over lists ; List Comprehensions is optional); sections 3.2-3.4
More informationAssignment 7: Due Wednesday May 11 at 6pm UPDATES on Monday May 9
CS1110 Spring 2016 Assignment 7: Due Wednesday May 11 at 6pm UPDATES on Monday May 9 You must work either on your own or with one partner. If you work with a partner, you and your partner must first register
More informationMath 2250 Lab #3: Landing on Target
Math 2250 Lab #3: Landing on Target 1. INTRODUCTION TO THE LAB PROGRAM. Here are some general notes and ideas which will help you with the lab. The purpose of the lab program is to expose you to problems
More informationIntro. Scheme Basics. scm> 5 5. scm>
Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if
More informationExam 1 Format, Concepts, What you should be able to do, and Sample Problems
CSSE 120 Introduction to Software Development Exam 1 Format, Concepts, What you should be able to do, and Sample Problems Page 1 of 6 Format: The exam will have two sections: Part 1: Paper-and-Pencil o
More informationCISC 181 Lab 2 (100 pts) Due: March 7 at midnight (This is a two-week lab)
CISC 181 Lab 2 (100 pts) Due: March 7 at midnight (This is a two-week lab) This lab may be done individually or with a partner. Working with a partner DOES NOT mean, you do the evens, and I ll do the odds.
More informationBefore submitting the file project4.py, check carefully that the header above is correctly completed:
1 of 7 8/26/2013 12:43 PM Due date: November 7th, 23:59PM This is a team project. The project is worth 100 points. All the team members will get an equal grade. ONLY the team leader must turn-in the project.
More informationCMPSCI 187 / Spring 2015 Postfix Expression Evaluator
CMPSCI 187 / Spring 2015 Postfix Expression Evaluator Due on Thursday, 05 March, 8:30 a.m. Marc Liberatore and John Ridgway Morrill I N375 Section 01 @ 10:00 Section 02 @ 08:30 1 CMPSCI 187 / Spring 2015
More informationIntroduction to Python Part 2
Introduction to Python Part 2 v0.2 Brian Gregor Research Computing Services Information Services & Technology Tutorial Outline Part 2 Functions Tuples and dictionaries Modules numpy and matplotlib modules
More informationIntroduction to Unix - Lab Exercise 0
Introduction to Unix - Lab Exercise 0 Along with this document you should also receive a printout entitled First Year Survival Guide which is a (very) basic introduction to Unix and your life in the CSE
More informationAscii Art. CS 1301 Individual Homework 7 Ascii Art Due: Monday April 4 th, before 11:55pm Out of 100 points
CS 1301 Individual Homework 7 Ascii Art Due: Monday April 4 th, before 11:55pm Out of 100 points Files to submit: 1. HW7.py THIS IS AN INDIVIDUAL ASSIGNMENT! You should work individually on this assignment.
More informationUniversity of Washington CSE 140 Data Programming Winter Final exam. March 11, 2013
University of Washington CSE 140 Data Programming Winter 2013 Final exam March 11, 2013 Name: Section: UW Net ID (username): This exam is closed book, closed notes. You have 50 minutes to complete it.
More information: Intro Programming for Scientists and Engineers Final Exam
Final Exam Page 1 of 6 600.112: Intro Programming for Scientists and Engineers Final Exam Peter H. Fröhlich phf@cs.jhu.edu December 20, 2012 Time: 40 Minutes Start here: Please fill in the following important
More informationFishnet Assignment 1: Distance Vector Routing Due: May 13, 2002.
Fishnet Assignment 1: Distance Vector Routing Due: May 13, 2002. In this assignment, you will work in teams of one to four (try to form you own group; if you can t find one, you can either work alone,
More informationQuick Reference Tables
Quick Reference Tables Chapter 1 Raspberry Pi Startup Command Quick Reference Table Command startx sudo sudo shutdown -h now sudo shutdown -r now Launches the Raspbian desktop environment (GUI). Gives
More informationProject 2: After Image
Project 2: After Image FIT100 Winter 2007 Have you ever stared at an image and noticed that when it disappeared, a shadow of the image was still briefly visible. This is called an after image, and we experiment
More informationCOM110: Lab 2 Numeric expressions, strings, and some file processing (chapters 3 and 5)
COM110: Lab 2 Numeric expressions, strings, and some file processing (chapters 3 and 5) 1) Practice submitting programming assignment 1. Take a few arbitrary modules (.py files) that you have written and
More informationHands on Assignment 1
Hands on Assignment 1 CSci 2021-10, Fall 2018. Released Sept 10, 2018. Due Sept 24, 2018 at 11:55 PM Introduction Your task for this assignment is to build a command-line spell-checking program. You may
More informationCMSC 201 Spring 2018 Lab 13 Dictionaries
CMSC 201 Spring 2018 Lab 13 Dictionaries Assignment: Lab 13 Dictionaries Due Date: During discussion, April 30th through May 3rd Value: 10 points (8 points during lab, 2 points for Pre Lab quiz) This week
More informationDocument Formatting and Page Layout
Word 2013 Document Formatting and Page Layout Introduction Instructional designers create a lot of documents such as job aids, training manuals, memos, and so forth. They do so using Word software. While
More information15-110: Principles of Computing, Spring 2018
15-110: Principles of Computing, Spring 2018 Problem Set 5 (PS5) Due: Friday, February 23 by 2:30PM via Gradescope Hand-in HANDIN INSTRUCTIONS Download a copy of this PDF file. You have two ways to fill
More informationProgramming with Python
Programming with Python Dr Ben Dudson Department of Physics, University of York 21st January 2011 http://www-users.york.ac.uk/ bd512/teaching.shtml Dr Ben Dudson Introduction to Programming - Lecture 2
More informationENCM 339 Fall 2017: Editing and Running Programs in the Lab
page 1 of 8 ENCM 339 Fall 2017: Editing and Running Programs in the Lab Steve Norman Department of Electrical & Computer Engineering University of Calgary September 2017 Introduction This document is a
More informationSpring CS Homework 3 p. 1. CS Homework 3
Spring 2018 - CS 111 - Homework 3 p. 1 Deadline 11:59 pm on Friday, February 9, 2018 Purpose CS 111 - Homework 3 To try out another testing function, check-within, to get more practice using the design
More informationCS1 Lecture 4 Jan. 23, 2019
CS1 Lecture 4 Jan. 23, 2019 First graded discussion sections this week yesterday/today 10 DS assignments worth 2 points each everyone gets one free 2-pointer. I.e. your lowest DS grade will be replaced
More informationFundamentals: Expressions and Assignment
Fundamentals: Expressions and Assignment A typical Python program is made up of one or more statements, which are executed, or run, by a Python console (also known as a shell) for their side effects e.g,
More informationAREA Judo Math Inc.
AREA 2013 Judo Math Inc. 6 th grade Problem Solving Discipline: Black Belt Training Order of Mastery: Area 1. Area of triangles by composition 2. Area of quadrilaterals by decomposing 3. Draw polygons
More informationLab 4 S Objectives. The string type. Exercise 0
Lab 4 S2 2017 Lab 4 Note: There may be more exercises in this lab than you can finish during the lab time. If you do not have time to finish all exercises (in particular, the programming problems), you
More informationCMPSCI 187 / Spring 2015 Implementing Sets Using Linked Lists
CMPSCI 187 / Spring 2015 Implementing Sets Using Linked Lists Due on Tuesday February 24, 2015, 8:30 a.m. Marc Liberatore and John Ridgway Morrill I N375 Section 01 @ 10:00 Section 02 @ 08:30 1 CMPSCI
More informationCS 1803 Pair Homework 3 Calculator Pair Fun Due: Wednesday, September 15th, before 6 PM Out of 100 points
CS 1803 Pair Homework 3 Calculator Pair Fun Due: Wednesday, September 15th, before 6 PM Out of 100 points Files to submit: 1. HW3.py This is a PAIR PROGRAMMING Assignment: Work with your partner! For pair
More informationCMSC 201 Fall 2015 Lab 12 Tuples and Dictionaries
CMSC 201 Fall 2015 Lab 12 Tuples and Dictionaries Assignment: Lab 12 Tuples and Dictionaries Due Date: During discussion, November 30 th through December 3 rd Value: 1% of final grade Part 1: Data Types
More informationAssignment 4: Due Friday Mar 11 at 6pm
CS1110 Spring 2016 Assignment 4: Due Friday Mar 11 at 6pm You must work either on your own or with one partner. If you work with a partner, you and your partner must first register as a group in CMS (this
More informationComputer Science AP/X CSCI-140/242 Polygons Lab 2 8/30/2018
Computer Science AP/X CSCI-140/242 Polygons Lab 2 8/30/2018 1 Implementation You will now implement a program that handles the general case of drawing polygons of decreasing sides, recursively. 1.1 Program
More informationInput, output, and sequence
Chapter 29 Input, output, and sequence For this chapter, switch languages in DrRacket to Advanced Student Language. In the real world, we don t usually give a computer all the information it needs, all
More informationCS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG
CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG 1 Notice Reading Assignment Chapter 1: Introduction to Java Programming Homework 1 It is due this coming Sunday
More informationLab 8 - Vectors, and Debugging. Directions
Lab 8 - Vectors, and Debugging. Directions The labs are marked based on attendance and effort. It is your responsibility to ensure the TA records your progress by the end of the lab. While completing these
More informationroboturtle Documentation
roboturtle Documentation Release 0.1 Nicholas A. Del Grosso November 28, 2016 Contents 1 Micro-Workshop 1: Introduction to Python with Turtle Graphics 3 1.1 Workshop Description..........................................
More informationTurtle Graphics and L-systems Informatics 1 Functional Programming: Tutorial 7
Turtle Graphics and L-systems Informatics 1 Functional Programming: Tutorial 7 Heijltjes, Wadler Due: The tutorial of week 9 (20/21 Nov.) Reading assignment: Chapters 15 17 (pp. 280 382) Please attempt
More informationChapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.
Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of
More informationNote: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.
Com S 227 Fall 2017 Miniassignment 1 50 points Due Date: Monday, October 16, 11:59 pm (midnight) Late deadline (25% penalty): Tuesday, October 17, 11:59 pm General information This assignment is to be
More informationSemester 2, 2018: Lab 1
Semester 2, 2018: Lab 1 S2 2018 Lab 1 This lab has two parts. Part A is intended to help you familiarise yourself with the computing environment found on the CSIT lab computers which you will be using
More informationPrivacy and Security in Online Social Networks Department of Computer Science and Engineering Indian Institute of Technology, Madras
Privacy and Security in Online Social Networks Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 08 Tutorial 2, Part 2, Facebook API (Refer Slide Time: 00:12)
More informationCS 3030 Scripting Languages Syllabus
General Information CS 3030 Scripting Languages Semester: Fall 2017 Textbook: Location: Instructor Info: None. We will use freely available resources from the Internet. Online Ted Cowan tedcowan@weber.edu
More informationCS1 Lecture 13 Feb. 13, 2019
CS1 Lecture 13 Feb. 13, 2019 Exam 1, Thursday evening, 2/21, 6:30-8:00pm, W290 CB Email about make-ups will be sent tomorrow HW4 Q1 available. Q2 Q4 tomorrow. For Q1 only, Academic Honesty policy does
More informationThe Big Python Guide
The Big Python Guide Big Python Guide - Page 1 Contents Input, Output and Variables........ 3 Selection (if...then)......... 4 Iteration (for loops)......... 5 Iteration (while loops)........ 6 String
More informationCMSC 201 Spring 2016 Lab 08 Strings and File I/O
CMSC 201 Spring 2016 Lab 08 Strings and File I/O Assignment: Lab 08 Strings and File I/O Due Date: During discussion, April 4 th through April 7 th Value: 10 points Part 1: File Input Using files as input
More informationCPS109 Lab 1. i. To become familiar with the Ryerson Computer Science laboratory environment.
CPS109 Lab 1 Source: Partly from Big Java lab1, by Cay Horstmann. Objective: i. To become familiar with the Ryerson Computer Science laboratory environment. ii. To obtain your login id and to set your
More informationAssignment 0. Nothing here to hand in
Assignment 0 Nothing here to hand in The questions here have solutions attached. Follow the solutions to see what to do, if you cannot otherwise guess. Though there is nothing here to hand in, it is very
More informationCreate Turtles with Python
Create Turtles with Python BY PATRICIA FOSTER / PROGRAMMING / OCTOBER 2017 ISSUE Create turtles with Python, the programming language. Turtles make great pets. They re small, slow, and clean. Plus, who
More informationProcedures: Algorithms and Abstraction
Procedures: Algorithms and Abstraction 5 5.1 Objectives After completing this module, a student should be able to: Read and understand simple NetLogo models. Make changes to NetLogo procedures and predict
More informationPROGRAMMING FUNDAMENTALS
PROGRAMMING FUNDAMENTALS TESTING, MAIN, GLOBAL VARIABLES João Correia Lopes INESC TEC, FEUP 23 October 2018 FPRO/MIEIC/2018-19 23/10/2018 1 / 24 INTRODUCTION GOALS By the end of this class, the student
More informationCS195H Homework 1 Grid homotopies and free groups. Due: February 5, 2015, before class
CS195H Homework 1 Grid homotopies and free groups This second homework is almost all about grid homotopies and grid curves, but with a little math in the middle. This homework, last year, took people about
More informationPart III Appendices 165
Part III Appendices 165 Appendix A Technical Instructions Learning Outcomes This material will help you learn how to use the software you need to do your work in this course. You won t be tested on it.
More informationProject 1 Computer Science 2334 Spring 2016 This project is individual work. Each student must complete this assignment independently.
Project 1 Computer Science 2334 Spring 2016 This project is individual work. Each student must complete this assignment independently. User Request: Create a simple movie data system. Milestones: 1. Use
More informationClass #1. introduction, functions, variables, conditionals
Class #1 introduction, functions, variables, conditionals what is processing hello world tour of the grounds functions,expressions, statements console/debugging drawing data types and variables decisions
More informationOne of the hardest things you have to do is to keep track of three kinds of commands when writing and running computer programs. Those commands are:
INTRODUCTION Your first daily assignment is to modify the program test.py to make it more friendly. But first, you need to learn how to edit programs quickly and efficiently. That means using the keyboard
More informationCS 1803 Pair Homework 4 Greedy Scheduler (Part I) Due: Wednesday, September 29th, before 6 PM Out of 100 points
CS 1803 Pair Homework 4 Greedy Scheduler (Part I) Due: Wednesday, September 29th, before 6 PM Out of 100 points Files to submit: 1. HW4.py This is a PAIR PROGRAMMING Assignment: Work with your partner!
More informationLines of Symmetry. Grade 3. Amy Hahn. Education 334: MW 8 9:20 a.m.
Lines of Symmetry Grade 3 Amy Hahn Education 334: MW 8 9:20 a.m. GRADE 3 V. SPATIAL SENSE, GEOMETRY AND MEASUREMENT A. Spatial Sense Understand the concept of reflection symmetry as applied to geometric
More informationCMSC 201 Fall 2016 Homework 6 Functions
CMSC 201 Fall 2016 Homework 6 Functions Assignment: Homework 6 Functions Due Date: Wednesday, October 26th, 2016 by 8:59:59 PM Value: 40 points Collaboration: For Homework 6, collaboration is not allowed
More informationENGR 102 Engineering Lab I - Computation
ENGR 102 Engineering Lab I - Computation Week 07: Arrays and Lists of Data Introduction to Arrays In last week s lecture, 1 we were introduced to the mathematical concept of an array through the equation
More informationEnter the site Title: Student Name s eportfolio Choose your Website Domain: Use a Subdomain of Weebly.com
Weebly Tutorial Tutorial #1: Signing Up: Welcome to this tutorial. I m going to show you how to sign up for an account with Weebly so you can start building your eportfolio. Go to www.weebly.com. You can
More informationCS150 - Sample Final
CS150 - Sample Final Name: Honor code: You may use the following material on this exam: The final exam cheat sheet which I have provided The matlab basics handout (without any additional notes) Up to two
More informationCS1 Lecture 12 Feb. 11, 2019
CS1 Lecture 12 Feb. 11, 2019 HW4 available tomorrow, due next Wed. Discussion sections this week will be closely tied to one of the homework problems. Exam 1, Thursday evening, 2/21, 6:30-8:00pm HW2 scores
More informationCS Lab 8. Part 1 - Basics of File I/O
CS 105 - Lab 8 Today, you will be doing a lot with files! We will start with the basics of reading and writing and then expand upon the pixel value work that you did in a previous lab by working on image
More informationUnderstanding the Screen
Starting Starting Logo Logo Understanding the Screen Where you will write programs. You can just type methods or commands in here. Ex: t.forward() A Little Logo History What is LOGO? A programming language
More informationDownload Free Pictures & Wallpaper from the Internet
Download Free Pictures & Wallpaper from the Internet D 600 / 1 Millions of Free Graphics and Images at Your Fingertips! Discover How To Get Your Hands on Them Almost any type of document you create can
More informationTips from the experts: How to waste a lot of time on this assignment
Com S 227 Spring 2018 Assignment 1 100 points Due Date: Friday, September 14, 11:59 pm (midnight) Late deadline (25% penalty): Monday, September 17, 11:59 pm General information This assignment is to be
More informationCS 2316 Individual Homework 4 Greedy Scheduler (Part I) Due: Wednesday, September 18th, before 11:55 PM Out of 100 points
CS 2316 Individual Homework 4 Greedy Scheduler (Part I) Due: Wednesday, September 18th, before 11:55 PM Out of 100 points Files to submit: 1. HW4.py This is an INDIVIDUAL assignment! Collaboration at a
More informationCS 1110, LAB 1: PYTHON EXPRESSIONS.
CS 1110, LAB 1: PYTHON EXPRESSIONS Name: Net-ID: There is an online version of these instructions at http://www.cs.cornell.edu/courses/cs1110/2012fa/labs/lab1 You may wish to use that version of the instructions.
More informationSection 1: Let s Shake Off the Rust!
CSc 127B Introduction to Computer Science II Fall 2015 (McCann) http://www.cs.arizona.edu/classes/cs127b/fall15/ Section 1: Let s Shake Off the Rust! Your section leader should have told you to pair up
More informationFractals: Self-Similarity and Fractal Dimension Math 198, Spring 2013
Fractals: Self-Similarity and Fractal Dimension Math 198, Spring 2013 Background Fractal geometry is one of the most important developments in mathematics in the second half of the 20th century. Fractals
More informationProject #1 rev 2 Computer Science 2334 Fall 2013 This project is individual work. Each student must complete this assignment independently.
Project #1 rev 2 Computer Science 2334 Fall 2013 This project is individual work. Each student must complete this assignment independently. User Request: Create a simple magazine data system. Milestones:
More informationActivity: page 1/10 Introduction to Excel. Getting Started
Activity: page 1/10 Introduction to Excel Excel is a computer spreadsheet program. Spreadsheets are convenient to use for entering and analyzing data. Although Excel has many capabilities for analyzing
More informationClouds, biological growth, and coastlines are
L A B 11 KOCH SNOWFLAKE Fractals Clouds, biological growth, and coastlines are examples of real-life phenomena that seem too complex to be described using typical mathematical functions or relationships.
More informationWeek 1: Introduction to R, part 1
Week 1: Introduction to R, part 1 Goals Learning how to start with R and RStudio Use the command line Use functions in R Learning the Tools What is R? What is RStudio? Getting started R is a computer program
More information