Lab 4: Strings/While Loops Due Sun, Apr 17 at midnight
|
|
- Trevor Austin
- 5 years ago
- Views:
Transcription
1 Lab 4: Strings/While Loops Due Sun, Apr 17 at midnight For this lab, you must work with a partner. You should choose a new partner. Remember to turn in your peer review. All functions should be commented appropriately. Create a file called lab4.py. Include as comments your name, your partner s name, class time, TA s name, and lab due date. Then include and comment the following functions: Note: Unless otherwise noted, always include comments for each function that include the input type(s), the output type, how your function calculates, and then at least two test cases. If test cases aren t possible because of random numbers or user input, then give examples of what should happen. Attendance week 1: 2 pts Attendance week 2: 2 pts Part 1: Convert the following recursive functions to while loops: # Problem 1 (2 pts) def f(x,y): if (x == 0): return(y) return(f(x-1,y+x)) print(f(5,0)) #Problem 2: (3 pts) def g(x,y): if y == len(x): print() return print(x[y],end = ", ") return(g(x,y+1)) k = "cats" g(k,0) #Problem 3: (3 pts) def h(x,y,a,b): if x == 5: return y if (x % 2 == 1): k = randrange(0,len(a)) return h(x+1,y+ a[k],a,b) k = randrange(0,len(b)) return h(x+1,y+ b[k],a,b) print(h(0,"","aeiou","bcdfghjklmnpqrstvwxyz"))
2 #Problem 4: (3 pts) def j(x,y,z): if y == 0: return z k = randrange(0,len(x)) if x[k] not in z: return(j(x,y-1,z+ x[k])) return(j(x,y,z)) print(j("vampire",len("vampire"),"")) #Problem 5 (3 pts) def k(x,y): if (x < 0): return k(x*-1,y) elif (x < 10): return(y) return k(x//10,y+1) print(k(-28417,1)) #Problem 6: (4 pts) Note: for this problem, you could convert the number to a string, #and then use 'in'. Don't do that. Use a while loop instead. Don't use #break. def m(x,y): if (x <= 0): return False if (x%10 == y): return True return m(x//10,y) print(m(3214,2)) print(m(4231,5)) Part 2: Do the following using While loops (no recursion!) #Problem 7. (5 pts) When I was a kid, I used to speak a language we called gibberish to my friend when we didn t want adults to understand us. For this language, every vowel would be replaced with ithag and then the vowel. So, for instance, For instance, the word cat would become cithagat Monkey would become mithagonkithagey Write the comments with input, output, and test cases for a function that uses a while loop to create a new word in the gibberish language. So every time a vowel is encountered in a word, it is replaced with ithag,then the vowel, then the rest of the word. Problem 8: (5 pts) Many digital identification numbers such as ISBNs, credit card numbers, bank routing numbers, and UPCs, and even routing packets, are designed with an extra bit, known as a parity bit, that helps detect (and sometimes correct) human entry errors. In this problem we will modify this a bit to
3 assume a simple check-digit algorithm: Parity will be determined by adding all the digits in the number up, minus the last digit (the right-most digit). If the digits add up to an even number and the right-most digit is a 0, then the number is most likely okay. If all the digits add up to an odd number and the right-most digit is a 1, then most likely the number is okay. If the digits don t match the parity number, then the number has probably been corrupted. If the parity number is anything other than a 1 or a 0, the parity number has been corrupted, Otherwise, as far as we know, the number is okay. Write a function (including comments) that uses a while loop to check the number s validity using the above checking system. This function will return a Boolean value. Problem 9: Simple encryption. Part a: (6 pts)you re going to take the alphabet (as a string) and create a new, randomly scrambled version of the alphabet. Each letter must only occur once in the new randomly scrambled version of the alphabet. So, for instance, my input was: z = "abcdefghijklmnopqrstuvwxyz" f9(z,"") and my returned string was: hsyevxgrjlpntfqbzwmkadocui Note: just use all small letters. Let s not deal with capital letters. Side Note: this is something that, when written in its simplest manner, is nicest when written with a while loop. It could end up looping for a long time when trying to find the last few letters that must be added to the encrypted string. We could improve efficiency greatly by creating a new string of leftover letters whenever we ve added over half the letters to the new string. Part b: (7 pts) Now, using the encrypted string above as input to your new function you are about to write, encrypt a word and return that word. For this, the easiest way to do it is to use the index method, which is built into python. Index returns the index of the first occurrence of a character in a string. So, for instance, using the above string z with the alphabet in it, to find the location of the character f in z, you d do the following: ind = z.index( f ) And ind would now hold 5 So, using the encrypted string above, if the input was cat, the returned value would be: yhk. Problem 10: (2 pts) A teacher may want students to practice their multiplication tables. Each week it s a different number. So for instance, one week the students should practice their 4s multiplication tables, and the next week their 6s multiplication tables.
4 Write a function that takes as an input parameter an integer. The function then generates a random number between 0 and 12 including 12. The function then uses the input command to ask the user, what is randnum times x? where randnum is the random number generated, and x is the input parameter. So, for instance, if the input parameter was 5, and the random number generated was 7, the user would be asked, what is 7 times 5? The function should then take the answer the user entered and check whether the user was correct or not, returning a Boolean value with True if the user was correct, and False if the user was wrong. 10b. (5 pts) Now create an online test. This test function will take as an input parameter an integer the test_num) representing number you are testing and an integer representing the number right (num_right) the user must get before they can quit the test. In the function, you will call the function you created above inside a loop. The loop will keep track of the number of times the student answered correctly (e.g., True is returned from the above function). If the student answers num_right correctly in a row, the function returns a string saying Congratulations! You finished! If, however, the student gets one wrong before getting num_right correct in a row, the count starts over at 0. Thus, there is only one way to get out of the loop, and that is for the user to get the answer correct num_right times in a row. Problem 11 Wacky BlackJack: (6 pts) You re going to write a function with a while loop that sort of replicates playing blackjack. Your function should generate random numbers between 1 and 11 until the user enters no in response to the input command, Do you wish to continue?. The user wants to come as close to 21 as possible without going over. (The loop should keep track of the total and print it out before asking if the user wants to continue). Once the user has decided not to continue (they entered, no ), the function should generate another random number (below the loop), this time between 15 and 26 (including 26). This is the dealer s hand. The function should print out the dealer s score. Then, if the Dealer s hand is over 21, the user automatically wins and a string should be returned saying that the user won. If the Dealer s hand is 21 or under, and the user s hand is over 21, the dealer wins and a string should be returned saying that the dealer won. If the dealer s hand is 21 or under and it is greater than the user s hand, a string should be returned saying that the dealer won. If the user s hand is 21 or under and greater than or equal to the dealer s hand (we re giving the user the advantage here), a string should be returned saying that the user won. Part b: (6 pts) Write a function that uses the input function to ask if the user wants to play another round. If they do, it uses a while loop to allow the user to place a bet (again, using the input function). Then call the function in 7a to play a round of wacky blackjack, and keep track of the total amount of money they have while they play (e.g., if they win, they double their bet, and if they lose, they lose it from their total.) Within the loop, the input function must be used to ask if the user wants to play another round. The while loop will continue while the user says yes and has some money left. You can start them out with 100 dollars. (Note: you are in essence calling a loop within a loop here.) Problem 12: Guess the number:
5 Part a (5 pts) Write a recursive function that takes as input parameters a number, and then 2 other numbers x and y, and finally a count parameter. 1. It uses the user input function to ask the user to guess a number between x and y. 2. If the random number is the same as the input parameter number, it returns a count of the number of guesses the computer had to make. 3. If the random number is too high, it first prints (str(randnum) + is too high! ) and then recurses with the range x to y changing so that you only guess between x and the random number (you d have to increase your count). 4. Do the same if the guess is too low. Part b: (7 pts) Now write the same exact function using while loops. Part c: (1 pt) Which is easier, the recursive version or the while loop? Part d: (3 pts) If you choose your guesses wisely, given the range of numbers in which you are guessing (e,g., 0-100, 0-50, etc.) AT MOST how many guesses will you make (hint: how many numbers do you rule out after each guess?) As a mental exercise, in the last lab you created a fractal using recursion. How easy would this be to do using while loops? Problem 13: Nested Loops: For these problems you MUST use nested loops you cannot use string multiplication: Part A(8): Write a non-recursive function that takes as input parameters 2 numbers. It then generates x (the first input parameter) random numbers between 0 and y (the second input parameter). For each random number, it then prints out that many stars across the page (using end = ). So, for example, if the input parameters were 6 and 10, I might get an output looking like this: ****** * **** *** ***** ***** Part B(8): Print out the multiplication tables as follows, if the input parameters are 6 and 4, you d print out: * * * *
6 Note: for this one, you will probably want to use the tab for formatting, e.g., (end= \t ) Part C (10): Now, given an input parameter x, create an x shape using nested loops. So for instance, if the input parameter was 4, you d print out: * Extra Credit (10 pts): Your job: get the string to sum to 100, by inserting in the string two minus symbols and one plus symbol (in any order) to make the formula correct. You aren't allowed to re-arrange digits, or do some toothpick math like combine two minus signs to make a plus. You must use every digit, and all three operators. For example, here's one incorrect solution: = 100 (This is an incorrect formula; it totals 12) You want to write a function that does the thinking for you. It should output every possible equation that can be formed, and the actual result of that equation. The equation(s) that result in 100 should have stars around them. At the end, you should print out the number(s) of formulae that were possible. Here's an excerpt of some example output: = = = = = = possible equations tested Hint: This problem heavily relies on loops and slicing.
7
Lab 4: Strings/Loops Due Apr 22 at midnight
Lab 4: Strings/Loops Due Apr 22 at midnight For this lab, you must work with a partner. All functions should be commented appropriately. If there are random numbers, the function must still be commen ted
More informationLab 2: Booleans, Strings, Random Numbers, Recursion, Variables, Input function
Lab 2: Booleans, Strings, Random Numbers, Recursion, Variables, Input function Due: Mar13 (Note that this is a 2-week lab) This lab must be done using paired partners. You should choose a different partner
More informationLab 2: Booleans, Strings, Random Numbers, Recursion, Variables, Input function
Lab 2: Booleans, Strings, Random Numbers, Recursion, Variables, Input function Due: Mar25 (Note that this is a 2-week lab) This lab must be done using paired partners. You should choose a different partner
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 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 informationLOOPS. Repetition using the while statement
1 LOOPS Loops are an extremely useful feature in any programming language. They allow you to direct the computer to execute certain statements more than once. In Python, there are two kinds of loops: while
More informationCom S 127x - Lab 6 1. READING FLOWCHARTS WITH CONDITIONAL ACTIONS!
Com S 127x - Lab 6 1. READING FLOWCHARTS WITH CONDITIONAL ACTIONS! The U.S. Postal Service has some complex rules for deciding how much it costs to mail a letter. We ll use a small part of these rules
More informationIntro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming
Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals
More informationMath for Liberal Studies
Math for Liberal Studies An identification number is a sequence of letters and/or numbers that identifies an object, person, place, or concept The number should unambiguously identify something: no two
More informationHonors Computer Science Python Mr. Clausen Programs 4A, 4B, 4C, 4D, 4E, 4F
PROGRAM 4A Full Names (25 points) Honors Computer Science Python Mr. Clausen Programs 4A, 4B, 4C, 4D, 4E, 4F This program should ask the user for their full name: first name, a space, middle name, a space,
More informationText Input and Conditionals
Text Input and Conditionals Text Input Many programs allow the user to enter information, like a username and password. Python makes taking input from the user seamless with a single line of code: input()
More informationProgramming Lab 1 (JS Hwk 3) Due Thursday, April 28
Programming Lab 1 (JS Hwk 3) Due Thursday, April 28 Lab You may work with partners for these problems. Make sure you put BOTH names on the problems. Create a folder named JSLab3, and place all of the web
More informationRemaining Enhanced Labs
Here are some announcements regarding the end of the semester, and the specifications for the last Enhanced Labs. Don t forget that you need to take the Common Final Examination on Saturday, May 5, from
More informationThe little book of programming challenges
24 The little book of programming challenges The following challenges are here to challenge and inspire you as well as help you on your journey to becoming a computational thinker. You may be set these
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 informationAdmin. How's the project coming? After these slides, read chapter 13 in your book. Quizzes will return
Recursion CS 1 Admin How's the project coming? After these slides, read chapter 13 in your book Yes that is out of order, but we can read it stand alone Quizzes will return Tuesday Nov 29 th see calendar
More informationRECURSION, RECURSION, (TREE) RECURSION! 2
RECURSION, RECURSION, (TREE) RECURSION! 2 COMPUTER SCIENCE 61A February 5, 2015 A function is recursive if it calls itself. Below is a recursive factorial function. def factorial(n): if n == 0 or n ==
More informationCpSc 111 Lab 5 Conditional Statements, Loops, the Math Library, and Redirecting Input
CpSc Lab 5 Conditional Statements, Loops, the Math Library, and Redirecting Input Overview For this lab, you will use: one or more of the conditional statements explained below scanf() or fscanf() to read
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 informationCSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch
CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch Purpose: We will take a look at programming this week using a language called Scratch. Scratch is a programming language that was developed
More informationProblem 1.1 (3 pts) :Python uses atomic data types and builds up from there. Give an example of: a. an int b. a double c. a string
Lab 1: Due Sunday, Feb 28, midnight This is a paired programming lab: In this lab you will work in pairs. In lab, you will choose your partner for the next two weeks. Get your partner s name and email
More informationCS 134 Programming Exercise 2:
CS 134 Programming Exercise 2: Dirty Laundry Objective: To gain experience using conditionals. The Scenario. One thing some students have to figure out for the first time when they come to college is how
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 informationCIS220 In Class/Lab 1: Due Sunday night at midnight. Submit all files through Canvas (25 pts)
CIS220 In Class/Lab 1: Due Sunday night at midnight. Submit all files through Canvas (25 pts) Problem 0: Install Eclipse + CDT (or, as an alternative, Netbeans). Follow the instructions on my web site.
More information(Python) Chapter 3: Repetition
(Python) Chapter 3: Repetition 3.1 while loop Motivation Using our current set of tools, repeating a simple statement many times is tedious. The only item we can currently repeat easily is printing the
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 informationUse the Associative Property of Multiplication to find the product.
3-1 1. The Associative Property of Multiplication states factors can be grouped differently and the product remains the same. Changing the grouping of the factors changes the factors that are multiplied
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 informationTable of Laplace Transforms
Table of Laplace Transforms 1 1 2 3 4, p > -1 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 Heaviside Function 27 28. Dirac Delta Function 29 30. 31 32. 1 33 34. 35 36. 37 Laplace Transforms
More informationNAME EET 2259 Lab 3 The Boolean Data Type
NAME EET 2259 Lab 3 The Boolean Data Type OBJECTIVES - Understand the differences between numeric data and Boolean data. -Write programs using LabVIEW s Boolean controls and indicators, Boolean constants,
More informationGetting Started. Excerpted from Hello World! Computer Programming for Kids and Other Beginners
Getting Started Excerpted from Hello World! Computer Programming for Kids and Other Beginners EARLY ACCESS EDITION Warren D. Sande and Carter Sande MEAP Release: May 2008 Softbound print: November 2008
More informationCPSC 320: Intermediate Algorithm Design and Analysis. Tutorial: Week 3
CPSC 320: Intermediate Algorithm Design and Analysis Author: Susanne Bradley Tutorial: Week 3 At the time of this week s tutorial, we were approaching the end of our stable matching unit and about to start
More informationRECURSION, RECURSION, (TREE) RECURSION! 3
RECURSION, RECURSION, (TREE) RECURSION! 3 COMPUTER SCIENCE 61A September 18, 2013 A function is recursive if it calls itself. Below is recursive factorial function. def factorial(n): if n == 0 or n ==
More information4. Use a loop to print the first 25 Fibonacci numbers. Do you need to store these values in a data structure such as an array or list?
1 Practice problems Here is a collection of some relatively straightforward problems that let you practice simple nuts and bolts of programming. Each problem is intended to be a separate program. 1. Write
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 informationDue Date: Two Program Demonstrations (Testing and Debugging): End of Lab
CSC 111 Fall 2005 Lab 6: Methods and Debugging Due Date: Two Program Demonstrations (Testing and Debugging): End of Lab Documented GameMethods file and Corrected HighLow game: Uploaded by midnight of lab
More informationAlgorithm Design and Recursion. Search and Sort Algorithms
Algorithm Design and Recursion Search and Sort Algorithms Objectives To understand the basic techniques for analyzing the efficiency of algorithms. To know what searching is and understand the algorithms
More informationMAT 142 College Mathematics. Module ST. Statistics. Terri Miller revised July 14, 2015
MAT 142 College Mathematics Statistics Module ST Terri Miller revised July 14, 2015 2 Statistics Data Organization and Visualization Basic Terms. A population is the set of all objects under study, a sample
More informationPython allows variables to hold string values, just like any other type (Boolean, int, float). So, the following assignment statements are valid:
1 STRINGS Objectives: How text data is internally represented as a string Accessing individual characters by a positive or negative index String slices Operations on strings: concatenation, comparison,
More informationCS 1110, LAB 10: ASSERTIONS AND WHILE-LOOPS 1. Preliminaries
CS 0, LAB 0: ASSERTIONS AND WHILE-LOOPS http://www.cs.cornell.edu/courses/cs0/20sp/labs/lab0.pdf. Preliminaries This lab gives you practice with writing loops using invariant-based reasoning. Invariants
More informationPattern Maker Lab. 1 Preliminaries. 1.1 Writing a Python program
Pattern Maker Lab Lab Goals: In this lab, you will write a Python program to generate different patterns using ASCII characters. In particular, you will get practice with the following: 1. Printing strings
More informationPROBLEM SOLVING 11. July 24, 2012
PROBLEM SOLVING 11 COMPUTER SCIENCE 61A July 24, 2012 Today s section will be a kind of Meta-Section, we are going to walk through some medium to hard-ish problems in Scheme, and we will discuss some methods
More information9. The Disorganized Handyman
9. The Disorganized Handyman A bad handyman always blames his tools. Famous Proverb. What if my hammer is made of paper? Can I blame it then? Author Unknown. Programming constructs and algorithmic paradigms
More informationFunctions that return lists
342 Chapter 23 Functions that return lists If you did exercises 22.5.15 or 22.5.16, you ve already written some functions that return lists, but only in a very simple way: adding one new element to the
More informationCISC220 Lab 2: Due Wed, Sep 26 at Midnight (110 pts)
CISC220 Lab 2: Due Wed, Sep 26 at Midnight (110 pts) For this lab you may work with a partner, or you may choose to work alone. If you choose to work with a partner, you are still responsible for the lab
More informationCS1 Lecture 5 Jan. 25, 2019
CS1 Lecture 5 Jan. 25, 2019 HW1 due Monday, 9:00am. Notes: Do not write all the code at once before starting to test. Take tiny steps. Write a few lines test... add a line or two test... add another line
More informationAPCS-AB: Java. Recursion in Java December 12, week14 1
APCS-AB: Java Recursion in Java December 12, 2005 week14 1 Check point Double Linked List - extra project grade Must turn in today MBCS - Chapter 1 Installation Exercises Analysis Questions week14 2 Scheme
More informationRECURSION 3. 1 Recursion COMPUTER SCIENCE 61A. June 30, 2016
RECURSION 3 COMPUTER SCIENCE 61A June 30, 2016 A recursive function is a function that calls itself. Here s a recursive function: def factorial(n): if n == 0 or n == 1: return 1 else: return n * factorial(n-1)
More informationCPSC 217 Assignment 4
CPSC 217 Assignment 4 Due: Friday December 8, 2017 at 11:55pm Weight: 7% Sample Solution Length: Approximately 130 lines (No comments and no code for the A+ part) Individual Work: All assignments in this
More informationEDIT202 Spreadsheet Lab Prep Sheet
EDIT202 Spreadsheet Lab Prep Sheet While it is clear to see how a spreadsheet may be used in a classroom to aid a teacher in marking (as your lab will clearly indicate), it should be noted that spreadsheets
More informationRECURSION 7. 1 Recursion COMPUTER SCIENCE 61A. October 15, 2012
RECURSION 7 COMPUTER SCIENCE 61A October 15, 2012 1 Recursion We say a procedure is recursive if it calls itself in its body. Below is an example of a recursive procedure to find the factorial of a positive
More informationDue Date: Friday, September 9 th Attached is your summer review packet for the Algebra 1 course.
Due Date: Friday, September 9 th Attached is your summer review packet for the Algebra 1 course. This is your first Graded HW grade. You MUST SHOW WORK in order to receive credit. This means if you typed
More informationIntroduction to Computer Science Unit 3. Programs
Introduction to Computer Science Unit 3. Programs This section must be updated to work with repl.it Programs 1 to 4 require you to use the mod, %, operator. 1. Let the user enter an integer. Your program
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 informationLecture 9: July 14, How to Think About Debugging
Lecture 9: July 14, 2011 How to Think About Debugging So, you wrote your program. And, guess what? It doesn t work. L Your program has a bug in it Somehow, you must track down the bug and fix it Need to
More informationFormatting: Cleaning Up Data
Formatting: Cleaning Up Data Hello and welcome to our lesson on cleaning up data, which is one of the final ones in this Formatting Module. What we re going to be doing in this lesson is using some of
More informationOutline. Announcements. Homework 2. Boolean expressions 10/12/2007. Announcements Homework 2 questions. Boolean expression
Outline ECS 10 10/8 Announcements Homework 2 questions Boolean expressions If/else statements State variables and avoiding sys.exit( ) Example: Coin flipping (if time permits) Announcements Professor Amenta
More informationCS 115 Lecture 4. More Python; testing software. Neil Moore
CS 115 Lecture 4 More Python; testing software Neil Moore Department of Computer Science University of Kentucky Lexington, Kentucky 40506 neil@cs.uky.edu 8 September 2015 Syntax: Statements A statement
More informationGateway Regional School District VERTICAL ARTICULATION OF MATHEMATICS STANDARDS Grades K-4
NUMBER SENSE & OPERATIONS K.N.1 Count by ones to at least 20. When you count, the last number word you say tells the number of items in the set. Counting a set of objects in a different order does not
More informationa b c d a b c d e 5 e 7
COMPSCI 230 Homework 9 Due on April 5, 2016 Work on this assignment either alone or in pairs. You may work with different partners on different assignments, but you can only have up to one partner for
More informationEC121 Mathematical Techniques A Revision Notes
EC Mathematical Techniques A Revision Notes EC Mathematical Techniques A Revision Notes Mathematical Techniques A begins with two weeks of intensive revision of basic arithmetic and algebra, to the level
More informationMidterm Exam 2B Answer key
Midterm Exam 2B Answer key 15110 Principles of Computing Fall 2015 April 6, 2015 Name: Andrew ID: Lab section: Instructions Answer each question neatly in the space provided. There are 6 questions totaling
More informationIn this section we take an aside from the normal discussion in algebra.
1.5 Set Notation In this section we take an aside from the normal discussion in algebra. We want to take a look at the topic of sets and set notation. The reason we want to do this is so that as we encounter
More informationCredit: The lecture slides are created based on previous lecture slides by Dan Zingaro.
CSC148 2018 Here 1 Credit: The lecture slides are created based on previous lecture slides by Dan Zingaro. 2 Larry Zhang Office: DH-3042 Email: ylzhang@cs.toronto.edu 3 The teaching team Dan Zingaro: LEC0103
More informationJS Lab 1: (Due Thurs, April 27)
JS Lab 1: (Due Thurs, April 27) For this lab, you may work with a partner, or you may work alone. If you choose a partner, this will be your partner for the final project. If you choose to do it with a
More information15110 PRINCIPLES OF COMPUTING SAMPLE EXAM 2
15110 PRINCIPLES OF COMPUTING SAMPLE EXAM 2 Name Section Directions: Answer each question neatly in the space provided. Please read each question carefully. You have 50 minutes for this exam. No electronic
More informationvar num1 = prompt("enter a number between 1 and 12","1"); var promptstring = "What is " + num1 + " times 3?"; var num2 = prompt(promptstring);
JavaScript Week 2: Last week we learned about the document, which is your html page, and document.write, which is one way in which javascript allows you to write html code to your web page. We also learned
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 informationNON-CALCULATOR ARITHMETIC
Mathematics Revision Guides Non-Calculator Arithmetic Page 1 of 30 M.K. HOME TUITION Mathematics Revision Guides: Level: GCSE Foundation Tier NON-CALCULATOR ARITHMETIC Version: 3.2 Date: 21-10-2016 Mathematics
More informationCSE413 Midterm. Question Max Points Total 100
CSE413 Midterm 05 November 2007 Name Student ID Answer all questions; show your work. You may use: 1. The Scheme language definition. 2. One 8.5 * 11 piece of paper with handwritten notes Other items,
More informationNotebook Assignments
Notebook Assignments These six assignments are a notebook using techniques from class in the single concrete context of graph theory. This is supplemental to your usual assignments, and is designed for
More information15-110: Principles of Computing, Spring 2018
5-: Principles of Computing, Spring 28 Problem Set 8 (PS8) Due: Friday, March 3 by 2:3PM via Gradescope Hand-in HANDIN INSTRUCTIONS Download a copy of this PDF file. You have two ways to fill in your answers:.
More informationPython Day 3 11/28/16
Python Day 3 11/28/16 Objectives Review Concepts Types of Errors Escape sequences String functions Find the Errors bookcost = int(input("how much is the book: ")) discount = float(input("what is the discount:
More informationCreate your first workbook
Create your first workbook You've been asked to enter data in Excel, but you've never worked with Excel. Where do you begin? Or perhaps you have worked in Excel a time or two, but you still wonder how
More informationEVALUATION ONLY. In this chapter, you will learn new. Text and Analysis EXCEL 2016 CHAPTER TIMING PROJECT: ANALYZING SALES INFORMATION
EXCEL 2016 3Advanced Functions for Text and Analysis In this chapter, you will learn new functions that give you greater ability for analysis and decision making. They include functions that either sum
More informationCSci 1113, Fall 2015 Lab Exercise 4 (Week 5): Write Your Own Functions. User Defined Functions
CSci 1113, Fall 2015 Lab Exercise 4 (Week 5): Write Your Own Functions User Defined Functions In previous labs, you've encountered useful functions, such as sqrt() and pow(), that were created by other
More informationCSC236 Week 4. Larry Zhang
CSC236 Week 4 Larry Zhang 1 Announcements PS2 is out Larry s office hours in the reading week: as usual Tuesday 12-2, Wednesday 2-4 2 NEW TOPIC Recursion To really understand the math of recursion, and
More informationLab 4 Due April 18 th
Lab 4 Due April 18 th (100 pts) You may work with a partner if you want. Turn in one version with 2 names on it. Do not forget your partner s name. Or work alone. Your choice. Problem 1 (10 pts): Create
More informationTopic 3: Fractions. Topic 1 Integers. Topic 2 Decimals. Topic 3 Fractions. Topic 4 Ratios. Topic 5 Percentages. Topic 6 Algebra
Topic : Fractions Topic Integers Topic Decimals Topic Fractions Topic Ratios Topic Percentages Duration / weeks Content Outline PART (/ week) Introduction Converting Fractions to Decimals Converting Decimals
More informationCS1110 Lab 6 (Mar 17-18, 2015)
CS1110 Lab 6 (Mar 17-18, 2015) First Name: Last Name: NetID: The lab assignments are very important and you must have a CS 1110 course consultant tell CMS that you did the work. (Correctness does not matter.)
More informationStage 11 Array Practice With. Zip Code Encoding
A Review of Strings You should now be proficient at using strings, but, as usual, there are a few more details you should know. First, remember these facts about strings: Array Practice With Strings are
More informationMath 155. Measures of Central Tendency Section 3.1
Math 155. Measures of Central Tendency Section 3.1 The word average can be used in a variety of contexts: for example, your average score on assignments or the average house price in Riverside. This is
More informationProgram Planning, Data Comparisons, Strings
Program Planning, Data Comparisons, Strings Program Planning Data Comparisons Strings Reading for this class: Dawson, Chapter 3 (p. 80 to end) and 4 Program Planning When you write your first programs,
More information(f) d={ alchemist :( a, t ), shaman : ( s, n ), wizard : ( w, z )} d[ shaman ][1]
CSCI1101 Final Exam December 18, 2018 Solutions 1. Determine the value and type of each of the expressions below. If the question has two lines, assume that the statement in the first line is executed,
More informationExercise 1 Using Boolean variables, incorporating JavaScript code into your HTML webpage and using the document object
CS1046 Lab 5 Timing: This lab should take you approximately 2 hours. Objectives: By the end of this lab you should be able to: Recognize a Boolean variable and identify the two values it can take Calculate
More informationINTRODUCTION TO MICROSOFT EXCEL: DATA ENTRY AND FORMULAS
P a g e 1 INTRODUCTION TO MICROSOFT EXCEL: DATA ENTRY AND FORMULAS MARGERT E HEGGAN FREE PUBLIC LIBRARY SECTION ONE: WHAT IS MICROSOFT EXCEL MICROSOFT EXCEL is a SPREADSHEET program used for organizing
More informationHello World! Computer Programming for Kids and Other Beginners. Chapter 1. by Warren Sande and Carter Sande. Copyright 2009 Manning Publications
Hello World! Computer Programming for Kids and Other Beginners by Warren Sande and Carter Sande Chapter 1 Copyright 2009 Manning Publications brief contents Preface xiii Acknowledgments xix About this
More informationGateway Regional School District VERTICAL ALIGNMENT OF MATHEMATICS STANDARDS Grades 3-6
NUMBER SENSE & OPERATIONS 3.N.1 Exhibit an understanding of the values of the digits in the base ten number system by reading, modeling, writing, comparing, and ordering whole numbers through 9,999. Our
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 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 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 informationPlotting Points. By Francine Wolfe Professor Susan Rodger Duke University June 2010
Plotting Points By Francine Wolfe Professor Susan Rodger Duke University June 2010 Description This tutorial will show you how to create a game where the player has to plot points on a graph. The method
More informationCME 193: Introduction to Scientific Python Lecture 1: Introduction
CME 193: Introduction to Scientific Python Lecture 1: Introduction Nolan Skochdopole stanford.edu/class/cme193 1: Introduction 1-1 Contents Administration Introduction Basics Variables Control statements
More informationCryptography Worksheet
Cryptography Worksheet People have always been interested in writing secret messages. In ancient times, people had to write secret messages to keep messengers and interceptors from reading their private
More informationRECURSION AND LINKED LISTS 3
RECURSION AND LINKED LISTS 3 COMPUTER SCIENCE 61A July 1, 2014 1 Termination and Warmup A function is recursive if executing a call to the function requires another call to the same function, called a
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 informationMolecular Statistics Exercise 1. As was shown to you this morning, the interactive python shell can add, subtract, multiply and divide numbers.
Molecular Statistics Exercise 1 Introduction This is the first exercise in the course Molecular Statistics. The exercises in this course are split in two parts. The first part of each exercise is a general
More informationCS 115 Lecture 8. Selection: the if statement. Neil Moore
CS 115 Lecture 8 Selection: the if statement Neil Moore Department of Computer Science University of Kentucky Lexington, Kentucky 40506 neil@cs.uky.edu 24 September 2015 Selection Sometime we want to execute
More informationCS 112: Intro to Comp Prog
CS 112: Intro to Comp Prog Importing modules Branching Loops Program Planning Arithmetic Program Lab Assignment #2 Upcoming Assignment #1 Solution CODE: # lab1.py # Student Name: John Noname # Assignment:
More informationComputer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Bits and Bytes and Numbers
Computer Science 324 Computer Architecture Mount Holyoke College Fall 2007 Topic Notes: Bits and Bytes and Numbers Number Systems Much of this is review, given the 221 prerequisite Question: how high can
More information